Skip to content

Commit dddcb5d

Browse files
authored
fix: assert copyright headers (#787)
utilizes flake8 plugin <https://pypi.org/project/flake8-copyright-validator/> to assert the correct headers Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
1 parent b2cc77e commit dddcb5d

Some content is hidden

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

53 files changed

+320
-32
lines changed

.flake8

+23
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,26 @@ ignore =
1818
ANN101,ANN102
1919
# ignore ANN401 for dynamically typed *args and **kwargs
2020
ANN401
21+
22+
## https://pypi.org/project/flake8-copyright-validator/
23+
lines-to-exclude =
24+
'#!/usr/bin/env python'
25+
26+
## https://pypi.org/project/flake8-copyright-validator/
27+
copyright-text =
28+
'# This file is part of CycloneDX Python'
29+
'#'
30+
'# Licensed under the Apache License, Version 2.0 (the "License");'
31+
'# you may not use this file except in compliance with the License.'
32+
'# You may obtain a copy of the License at'
33+
'#'
34+
'# http://www.apache.org/licenses/LICENSE-2.0'
35+
'#'
36+
'# Unless required by applicable law or agreed to in writing, software'
37+
'# distributed under the License is distributed on an "AS IS" BASIS,'
38+
'# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.'
39+
'# See the License for the specific language governing permissions and'
40+
'# limitations under the License.'
41+
'#'
42+
'# SPDX-License-Identifier: Apache-2.0'
43+
'# Copyright (c) OWASP Foundation. All Rights Reserved.'

cyclonedx_py/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This file is part of CycloneDX Python
2+
#
13
# Licensed under the Apache License, Version 2.0 (the "License");
24
# you may not use this file except in compliance with the License.
35
# You may obtain a copy of the License at

cyclonedx_py/__main__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This file is part of CycloneDX Python
2+
#
13
# Licensed under the Apache License, Version 2.0 (the "License");
24
# you may not use this file except in compliance with the License.
35
# You may obtain a copy of the License at

cyclonedx_py/_internal/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/cli_common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/environment.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/pipenv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/poetry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/requirements.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/utils/args.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/utils/cdx.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/utils/io.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/utils/license_trove_classifier.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/utils/mimetypes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/utils/packaging.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/utils/pep610.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/utils/pep621.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/utils/pep639.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/utils/poetry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/utils/pyproject.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1+
# This file is part of CycloneDX Python
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
# Copyright (c) OWASP Foundation. All Rights Reserved.
17+
18+
119
# use pyproject from pep621
220
# use pyproject from poetry implementation
321

4-
522
from typing import TYPE_CHECKING, Any, Dict, Iterator
623

724
from .pep621 import project2component, project2dependencies

cyclonedx_py/_internal/utils/secret.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cyclonedx_py/_internal/utils/toml.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ pip = ">=23.0"
101101
pipenv = ">=2023.11.5"
102102
poetry = "^1.7"
103103
pdm = "^2.11"
104+
flake8-copyright-validator = "^0.0.1"
104105

105106

106107

tests/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part of CycloneDX Python Lib
1+
# This file is part of CycloneDX Python
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

tests/_data/infiles/_helpers/local_pckages/a/module_a.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This file is part of CycloneDX Python
2+
#
13
# Licensed under the Apache License, Version 2.0 (the "License");
24
# you may not use this file except in compliance with the License.
35
# You may obtain a copy of the License at

tests/_data/infiles/_helpers/local_pckages/b/module_b.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This file is part of CycloneDX Python
2+
#
13
# Licensed under the Apache License, Version 2.0 (the "License");
24
# you may not use this file except in compliance with the License.
35
# You may obtain a copy of the License at

tests/_data/infiles/_helpers/local_pckages/c/module_c.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This file is part of CycloneDX Python
2+
#
13
# Licensed under the Apache License, Version 2.0 (the "License");
24
# you may not use this file except in compliance with the License.
35
# You may obtain a copy of the License at

tests/_data/infiles/_helpers/pypi-proxy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
# This file is part of CycloneDX Python Lib
3+
# This file is part of CycloneDX Python
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

tests/_data/infiles/environment/editable-self/init.py

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# This file is part of CycloneDX Python
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
# Copyright (c) OWASP Foundation. All Rights Reserved.
17+
118
"""
219
initialize this testbed.
320
"""

tests/_data/infiles/environment/local/init.py

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# This file is part of CycloneDX Python
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
# Copyright (c) OWASP Foundation. All Rights Reserved.
17+
118
"""
219
initialize this testbed.
320
"""

tests/_data/infiles/environment/no-deps/init.py

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# This file is part of CycloneDX Python
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
# Copyright (c) OWASP Foundation. All Rights Reserved.
17+
118
"""
219
initialize this testbed.
320
"""

tests/_data/infiles/environment/normalize-packagename/init.py

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# This file is part of CycloneDX Python
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
# Copyright (c) OWASP Foundation. All Rights Reserved.
17+
118
"""
219
initialize this testbed.
320
"""

tests/_data/infiles/environment/private-packages/init.py

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# This file is part of CycloneDX Python
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
# Copyright (c) OWASP Foundation. All Rights Reserved.
17+
118
"""
219
initialize this testbed.
320
"""

tests/_data/infiles/environment/via-pdm/init.py

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# This file is part of CycloneDX Python
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
# Copyright (c) OWASP Foundation. All Rights Reserved.
17+
118
"""
219
initialize this testbed.
320
"""

tests/_data/infiles/environment/via-pipenv/init.py

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# This file is part of CycloneDX Python
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
# Copyright (c) OWASP Foundation. All Rights Reserved.
17+
118
"""
219
initialize this testbed.
320
"""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file is part of CycloneDX Python
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
# Copyright (c) OWASP Foundation. All Rights Reserved.

0 commit comments

Comments
 (0)