diff --git a/Makefile b/Makefile
index fcef9159..296f6e29 100644
--- a/Makefile
+++ b/Makefile
@@ -137,14 +137,15 @@ install-go-mod-outdated:
## Checks, mocks and docs
-.PHONY: check-has-go check-license test bench coverage mocks lint updates doc
+.PHONY: check-has-go add-license change-copyright-year test bench coverage mocks lint-license lint-golang lint updates doc
check-has-go:
@which go || (echo "Install Go-lang!" && exit 1)
-check-license:
- RESULT=`find . -not -path "./vendor/*" -not -name "*mock*.go" -regextype posix-egrep -regex ".*\.go|.*\.qml" -exec grep -L 'Copyright (c) 2020 Proton Technologies AG' {} \;` ;\
- echo $${RESULT} ;\
- [[ -z "$${RESULT}" ]]
+add-license:
+ ./utils/missing_license.sh add
+
+change-copyright-year:
+ ./utils/missing_license.sh change-year
test: gofiles
@# Listing packages manually to not run Qt folder (which needs to run qtsetup first) and integration tests.
@@ -176,7 +177,12 @@ mocks:
mockgen --package mocks github.com/ProtonMail/proton-bridge/pkg/listener Listener > internal/store/mocks/utils_mocks.go
mockgen --package mocks github.com/ProtonMail/proton-bridge/pkg/pmapi Client > pkg/pmapi/mocks/mocks.go
-lint:
+lint: lint-golang lint-license
+
+lint-license:
+ ./utils/missing_license.sh check
+
+lint-golang:
which golangci-lint || $(MAKE) install-linter
golangci-lint run ./...
diff --git a/internal/frontend/share/icons/export.sh b/internal/frontend/share/icons/export.sh
old mode 100755
new mode 100644
index c352d4cf..d5c4c0e4
--- a/internal/frontend/share/icons/export.sh
+++ b/internal/frontend/share/icons/export.sh
@@ -1,5 +1,22 @@
#!/bin/bash
+# Copyright (c) 2020 Proton Technologies AG
+#
+# This file is part of ProtonMail Bridge.
+#
+# ProtonMail Bridge is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# ProtonMail Bridge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ProtonMail Bridge. If not, see .
+
# create bitmaps
for shape in rounded rectangle
do
diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go
index 38277477..02a46e8b 100644
--- a/pkg/constants/constants.go
+++ b/pkg/constants/constants.go
@@ -1,3 +1,20 @@
+// Copyright (c) 2020 Proton Technologies AG
+//
+// This file is part of ProtonMail Bridge.Bridge.
+//
+// ProtonMail Bridge is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// ProtonMail Bridge is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with ProtonMail Bridge. If not, see .
+
// Package constants contains variables that are set via ldflags during build.
package constants
diff --git a/pkg/pmapi/clientmanager_test.go b/pkg/pmapi/clientmanager_test.go
index 2bf60373..72402b9d 100644
--- a/pkg/pmapi/clientmanager_test.go
+++ b/pkg/pmapi/clientmanager_test.go
@@ -1,3 +1,20 @@
+// Copyright (c) 2020 Proton Technologies AG
+//
+// This file is part of ProtonMail Bridge.Bridge.
+//
+// ProtonMail Bridge is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// ProtonMail Bridge is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with ProtonMail Bridge. If not, see .
+
package pmapi
func newTestClientManager(cfg *ClientConfig) *ClientManager {
diff --git a/pkg/pmapi/dialer.go b/pkg/pmapi/dialer.go
index 421842ac..01076c3e 100644
--- a/pkg/pmapi/dialer.go
+++ b/pkg/pmapi/dialer.go
@@ -1,3 +1,20 @@
+// Copyright (c) 2020 Proton Technologies AG
+//
+// This file is part of ProtonMail Bridge.Bridge.
+//
+// ProtonMail Bridge is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// ProtonMail Bridge is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with ProtonMail Bridge. If not, see .
+
package pmapi
import (
diff --git a/pkg/pmapi/dialer_proxy.go b/pkg/pmapi/dialer_proxy.go
index c1425dbd..1e510e54 100644
--- a/pkg/pmapi/dialer_proxy.go
+++ b/pkg/pmapi/dialer_proxy.go
@@ -1,3 +1,20 @@
+// Copyright (c) 2020 Proton Technologies AG
+//
+// This file is part of ProtonMail Bridge.Bridge.
+//
+// ProtonMail Bridge is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// ProtonMail Bridge is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with ProtonMail Bridge. If not, see .
+
package pmapi
import (
diff --git a/pkg/pmapi/pin_checker.go b/pkg/pmapi/pin_checker.go
index 7818e3f5..920ae665 100644
--- a/pkg/pmapi/pin_checker.go
+++ b/pkg/pmapi/pin_checker.go
@@ -1,3 +1,20 @@
+// Copyright (c) 2020 Proton Technologies AG
+//
+// This file is part of ProtonMail Bridge.Bridge.
+//
+// ProtonMail Bridge is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// ProtonMail Bridge is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with ProtonMail Bridge. If not, see .
+
package pmapi
import (
diff --git a/pkg/pmapi/pin_checker_test.go b/pkg/pmapi/pin_checker_test.go
index 29d5b3ae..667f88e5 100644
--- a/pkg/pmapi/pin_checker_test.go
+++ b/pkg/pmapi/pin_checker_test.go
@@ -1,3 +1,20 @@
+// Copyright (c) 2020 Proton Technologies AG
+//
+// This file is part of ProtonMail Bridge.Bridge.
+//
+// ProtonMail Bridge is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// ProtonMail Bridge is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with ProtonMail Bridge. If not, see .
+
package pmapi
import (
diff --git a/pkg/pmapi/tlsreport.go b/pkg/pmapi/tlsreport.go
index 9c366ac7..8b6ddd74 100644
--- a/pkg/pmapi/tlsreport.go
+++ b/pkg/pmapi/tlsreport.go
@@ -1,3 +1,20 @@
+// Copyright (c) 2020 Proton Technologies AG
+//
+// This file is part of ProtonMail Bridge.Bridge.
+//
+// ProtonMail Bridge is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// ProtonMail Bridge is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with ProtonMail Bridge. If not, see .
+
package pmapi
import (
diff --git a/test/benchmarks/bench_results/human-table.py b/test/benchmarks/bench_results/human-table.py
index 34ff905b..ffe8a839 100644
--- a/test/benchmarks/bench_results/human-table.py
+++ b/test/benchmarks/bench_results/human-table.py
@@ -1,5 +1,23 @@
#!/usr/bin/env python
+# Copyright (c) 2020 Proton Technologies AG
+#
+# This file is part of ProtonMail Bridge.
+#
+# ProtonMail Bridge is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# ProtonMail Bridge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ProtonMail Bridge. If not, see .
+
+
import glob
import pandas as pd
import re
diff --git a/utils/credits.sh b/utils/credits.sh
index 8d55a5db..7943c1ad 100755
--- a/utils/credits.sh
+++ b/utils/credits.sh
@@ -1,5 +1,23 @@
#!/bin/bash
+
+# Copyright (c) 2020 Proton Technologies AG
+#
+# This file is part of ProtonMail Bridge.
+#
+# ProtonMail Bridge is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# ProtonMail Bridge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ProtonMail Bridge. If not, see .
+
## Generate credits from go.mod
# Vendor packages
@@ -12,22 +30,6 @@ echo -e "\nFont Awesome 4.7.0\n\nQt 5.13 by Qt group\n" >> tmp
# join lines
sed -i -e ':a' -e 'N' -e '$!ba' -e 's|\n|;|g' tmp
-echo '// Copyright (c) 2020 Proton Technologies AG
-//
-// This file is part of ProtonMail Bridge.
-//
-// ProtonMail Bridge is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// ProtonMail Bridge is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with ProtonMail Bridge. If not, see .
-' > ../internal/bridge/credits.go
+cat ../utils/license_header.txt > ../internal/bridge/credits.go
echo -e '// Code generated by '`echo $0`' at '`date`'. DO NOT EDIT.\n\npackage bridge\n\nconst Credits = "'$(cat tmp)'"' >> ../internal/bridge/credits.go
rm tmp1 tmp
diff --git a/utils/license_header.txt b/utils/license_header.txt
new file mode 100644
index 00000000..b1cc405f
--- /dev/null
+++ b/utils/license_header.txt
@@ -0,0 +1,17 @@
+// Copyright (c) 2020 Proton Technologies AG
+//
+// This file is part of ProtonMail Bridge.
+//
+// ProtonMail Bridge is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// ProtonMail Bridge is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with ProtonMail Bridge. If not, see .
+
diff --git a/utils/missing_license.sh b/utils/missing_license.sh
new file mode 100755
index 00000000..58b3fad8
--- /dev/null
+++ b/utils/missing_license.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# Copyright (c) 2020 Proton Technologies AG
+#
+# This file is part of ProtonMail Bridge.
+#
+# ProtonMail Bridge is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# ProtonMail Bridge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ProtonMail Bridge. If not, see .
+
+YEAR=`date +%Y`
+MISSING_FILES=`find . -not -path "./vendor/*" -not -path "./vendor-cache/*" -not -path "./.cache/*" -not -name "*mock*.go" -regextype posix-egrep -regex ".*\.go|.*\.qml|.*\.sh|.*\.py" -exec grep -L "Copyright (c) ${YEAR} Proton Technologies AG" {} \;`
+
+for f in ${MISSING_FILES}
+do
+ echo -n "MISSING LICENSE or WRONG YEAR in $f"
+ if [[ $1 == "add" ]]
+ then
+ cat ./utils/license_header.txt $f > tmp
+ mv tmp $f
+ echo -n "... license added"
+ fi
+ if [[ $1 == "change-year" ]]
+ then
+ sed -i "s/Copyright (c) [0-9]\\{4\\} Proton Technologies AG/Copyright (c) ${YEAR} Proton Technologies AG/" $f || exit 3
+ echo -n "... replaced copyright year"
+ fi
+ echo
+done
+
+[[ "$1" == "check" ]] && [[ -n ${MISSING_FILES} ]] && exit 1
+exit 0
diff --git a/utils/release-notes.sh b/utils/release-notes.sh
index 3c3b5d3c..019afdde 100755
--- a/utils/release-notes.sh
+++ b/utils/release-notes.sh
@@ -1,21 +1,23 @@
#!/bin/bash
+# Copyright (c) 2020 Proton Technologies AG
+#
+# This file is part of ProtonMail Bridge.
+#
+# ProtonMail Bridge is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# ProtonMail Bridge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ProtonMail Bridge. If not, see .
+
+
# Generate release notes information
-echo '// Copyright (c) 2020 Proton Technologies AG
-//
-// This file is part of ProtonMail Bridge.
-//
-// ProtonMail Bridge is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// ProtonMail Bridge is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with ProtonMail Bridge. If not, see .
-' > ../internal/bridge/release_notes.go
+cat ../utils/license_header.txt > ../internal/bridge/release_notes.go
echo -e '// Code generated by '`echo $0`' at '`date`'. DO NOT EDIT.\n\npackage bridge\n\nconst ReleaseNotes = `'"$(cat ../release-notes/notes.txt)"'\n`\n\nconst ReleaseFixedBugs = `'"$(cat ../release-notes/bugs.txt)"'\n`' >> ../internal/bridge/release_notes.go
diff --git a/utils/remove_non_relative_links_darwin.sh b/utils/remove_non_relative_links_darwin.sh
index 9cd7e296..9c2633f3 100755
--- a/utils/remove_non_relative_links_darwin.sh
+++ b/utils/remove_non_relative_links_darwin.sh
@@ -1,21 +1,21 @@
#!/bin/bash
-## Copyright (c) 2020 Proton Technologies AG
-##
-## This file is part of ProtonMail Bridge.
-##
-## ProtonMail Bridge is free software: you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## ProtonMail Bridge is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with ProtonMail Bridge. If not, see .
+# Copyright (c) 2020 Proton Technologies AG
+#
+# This file is part of ProtonMail Bridge.
+#
+# ProtonMail Bridge is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# ProtonMail Bridge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ProtonMail Bridge. If not, see .
## Make sure that mac exe will not contain broken library links
diff --git a/utils/sync_bench.py b/utils/sync_bench.py
index f7d009b8..ab0f12e5 100644
--- a/utils/sync_bench.py
+++ b/utils/sync_bench.py
@@ -1,6 +1,24 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
+# Copyright (c) 2020 Proton Technologies AG
+#
+# This file is part of ProtonMail Bridge.
+#
+# ProtonMail Bridge is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# ProtonMail Bridge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ProtonMail Bridge. If not, see .
+
+
# first try
data = {