Skip to content

Commit

Permalink
fix: assert copyright headers (#787)
Browse files Browse the repository at this point in the history
utilizes flake8 plugin
<https://pypi.org/project/flake8-copyright-validator/> to assert the
correct headers

Signed-off-by: Jan Kowalleck <[email protected]>
  • Loading branch information
jkowalleck authored Sep 18, 2024
1 parent b2cc77e commit dddcb5d
Show file tree
Hide file tree
Showing 53 changed files with 320 additions and 32 deletions.
23 changes: 23 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,26 @@ ignore =
ANN101,ANN102
# ignore ANN401 for dynamically typed *args and **kwargs
ANN401

## https://pypi.org/project/flake8-copyright-validator/
lines-to-exclude =
'#!/usr/bin/env python'

## https://pypi.org/project/flake8-copyright-validator/
copyright-text =
'# This file is part of CycloneDX Python'
'#'
'# Licensed under the Apache License, Version 2.0 (the "License");'
'# you may not use this file except in compliance with the License.'
'# You may obtain a copy of the License at'
'#'
'# http://www.apache.org/licenses/LICENSE-2.0'
'#'
'# Unless required by applicable law or agreed to in writing, software'
'# distributed under the License is distributed on an "AS IS" BASIS,'
'# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.'
'# See the License for the specific language governing permissions and'
'# limitations under the License.'
'#'
'# SPDX-License-Identifier: Apache-2.0'
'# Copyright (c) OWASP Foundation. All Rights Reserved.'
2 changes: 2 additions & 0 deletions cyclonedx_py/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 2 additions & 0 deletions cyclonedx_py/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/cli_common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/environment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/pipenv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/poetry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/requirements.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/utils/args.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/utils/cdx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/utils/io.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/utils/license_trove_classifier.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/utils/mimetypes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/utils/packaging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/utils/pep610.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/utils/pep621.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/utils/pep639.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/utils/poetry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
19 changes: 18 additions & 1 deletion cyclonedx_py/_internal/utils/pyproject.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.


# use pyproject from pep621
# use pyproject from poetry implementation


from typing import TYPE_CHECKING, Any, Dict, Iterator

from .pep621 import project2component, project2dependencies
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/utils/secret.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx_py/_internal/utils/toml.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pip = ">=23.0"
pipenv = ">=2023.11.5"
poetry = "^1.7"
pdm = "^2.11"
flake8-copyright-validator = "^0.0.1"



Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 2 additions & 0 deletions tests/_data/infiles/_helpers/local_pckages/a/module_a.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 2 additions & 0 deletions tests/_data/infiles/_helpers/local_pckages/b/module_b.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 2 additions & 0 deletions tests/_data/infiles/_helpers/local_pckages/c/module_c.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion tests/_data/infiles/_helpers/pypi-proxy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# This file is part of CycloneDX Python Lib
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
17 changes: 17 additions & 0 deletions tests/_data/infiles/environment/editable-self/init.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.

"""
initialize this testbed.
"""
Expand Down
17 changes: 17 additions & 0 deletions tests/_data/infiles/environment/local/init.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.

"""
initialize this testbed.
"""
Expand Down
17 changes: 17 additions & 0 deletions tests/_data/infiles/environment/no-deps/init.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.

"""
initialize this testbed.
"""
Expand Down
17 changes: 17 additions & 0 deletions tests/_data/infiles/environment/normalize-packagename/init.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.

"""
initialize this testbed.
"""
Expand Down
17 changes: 17 additions & 0 deletions tests/_data/infiles/environment/private-packages/init.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.

"""
initialize this testbed.
"""
Expand Down
17 changes: 17 additions & 0 deletions tests/_data/infiles/environment/via-pdm/init.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.

"""
initialize this testbed.
"""
Expand Down
17 changes: 17 additions & 0 deletions tests/_data/infiles/environment/via-pipenv/init.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.

"""
initialize this testbed.
"""
Expand Down
16 changes: 16 additions & 0 deletions tests/_data/infiles/environment/via-poetry/dummy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is part of CycloneDX Python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.
Loading

0 comments on commit dddcb5d

Please sign in to comment.