Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

License header formatting #983

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1737f51
Working license header formatter
natibek Jul 11, 2024
c274c39
Fix formatting
natibek Jul 11, 2024
8fde62b
Remove match case to if statements
natibek Jul 11, 2024
06cc52a
Reduce complexity
natibek Jul 11, 2024
d8a052c
Toml reading fixed for older python versions, improved printing
natibek Jul 16, 2024
4dbc5c4
Add license_header_format_ to all_.py
natibek Jul 16, 2024
350fbdb
Report number of incorrect license headers
natibek Jul 16, 2024
74db2da
Fix print for incorrect header case
natibek Jul 16, 2024
92e7900
Fix mypy issues
natibek Jul 16, 2024
50750a5
Fix license headers for repo
natibek Jul 16, 2024
3fa1d1c
Fix bug with appending Infleqtion to apache license
natibek Jul 16, 2024
5727998
Fix bug with appending Infleqtion to apache license
natibek Jul 16, 2024
23495e7
Merge branch 'main' into license-check
natibek Jul 17, 2024
6645aa8
Implement suggested changes
natibek Aug 5, 2024
05b5f61
Complete merge
natibek Aug 5, 2024
939ff01
Add license header
natibek Aug 5, 2024
47b3771
Edit docstrings and minor fixes
natibek Aug 5, 2024
ac45240
fix bad merge
natibek Aug 5, 2024
3e17822
Remove check for outdated license
natibek Aug 5, 2024
d2207c7
wildcard approach
natibek Aug 5, 2024
89372a3
Use copyright body similarity license header in file to check if they…
natibek Aug 6, 2024
893e546
Merge branch 'main' into license-check
natibek Aug 6, 2024
ae9285e
Replace checking for licensee in string with regex
natibek Aug 8, 2024
eddf930
Merge branch 'license-check' of github.com:Infleqtion/client-supersta…
natibek Aug 8, 2024
549e073
Merge branch 'main' into license-check
natibek Aug 8, 2024
8d79196
fix indent
natibek Aug 8, 2024
e5ac00e
add new line
natibek Aug 8, 2024
9534d2c
add license headers and minor fix for check
natibek Aug 8, 2024
0be382c
add similarity check for exact match case, fix header
natibek Aug 9, 2024
3b9aa34
Merge branch 'main' of github.com:Infleqtion/client-superstaq into li…
natibek Aug 9, 2024
0330f29
remove license_name field and improve similarity check accounting for…
natibek Aug 9, 2024
18fdef5
Merge from main and make suggested changes
natibek Aug 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions checks-superstaq/checks_superstaq/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2024 Infleqtion
#
# 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.
from checks_superstaq._version import __version__

from . import (
Expand All @@ -8,6 +21,7 @@
coverage_,
flake8_,
format_,
license_header_format_,
mypy_,
pylint_,
pytest_,
Expand All @@ -23,6 +37,7 @@
"coverage_",
"flake8_",
"format_",
"license_header_format_",
"mypy_",
"pylint_",
"pytest_",
Expand Down
19 changes: 19 additions & 0 deletions checks-superstaq/checks_superstaq/all_.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#!/usr/bin/env python3
# Copyright 2024 Infleqtion
#
# 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.
from __future__ import annotations

import sys
Expand All @@ -11,6 +24,7 @@
coverage_,
flake8_,
format_,
license_header_format_,
mypy_,
pylint_,
requirements,
Expand Down Expand Up @@ -69,6 +83,11 @@ def run(*args: str, sphinx_paths: list[str] | None = None) -> int:
checks_failed |= format_.run(*args_to_pass, exit_on_failure=exit_on_failure, silent=True)
checks_failed |= flake8_.run(*args_to_pass, exit_on_failure=exit_on_failure, silent=True)
checks_failed |= pylint_.run(*args_to_pass, exit_on_failure=exit_on_failure, silent=True)
checks_failed |= license_header_format_.run(
*args_to_pass,
exit_on_failure=exit_on_failure,
silent=True,
)

# run typing and coverage checks
exit_on_failure = not parsed_args.force_all
Expand Down
13 changes: 13 additions & 0 deletions checks-superstaq/checks_superstaq/build_docs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#!/usr/bin/env python3
# Copyright 2024 Infleqtion
#
# 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.
from __future__ import annotations

import os
Expand Down
13 changes: 13 additions & 0 deletions checks-superstaq/checks_superstaq/check_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2024 Infleqtion
#
# 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.
"""Dumping ground for check script utilities."""

from __future__ import annotations
Expand Down
19 changes: 19 additions & 0 deletions checks-superstaq/checks_superstaq/checks-pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
[tool.license_header_format]
license_header = """# Copyright 2024 Infleqtion
#
# 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.
"""
license_name = "Apache"
licensee = "Infleqtion"
editable = true

# Check script configuration:

[tool.pytest.ini_options]
Expand Down
13 changes: 13 additions & 0 deletions checks-superstaq/checks_superstaq/configs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#!/usr/bin/env python3
# Copyright 2024 Infleqtion
#
# 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.
from __future__ import annotations

import difflib
Expand Down
13 changes: 13 additions & 0 deletions checks-superstaq/checks_superstaq/coverage_.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#!/usr/bin/env python3
# Copyright 2024 Infleqtion
#
# 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.
from __future__ import annotations

import os
Expand Down
13 changes: 13 additions & 0 deletions checks-superstaq/checks_superstaq/flake8_.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#!/usr/bin/env python3
# Copyright 2024 Infleqtion
#
# 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.
from __future__ import annotations

import subprocess
Expand Down
13 changes: 13 additions & 0 deletions checks-superstaq/checks_superstaq/format_.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#!/usr/bin/env python3
# Copyright 2024 Infleqtion
#
# 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.
from __future__ import annotations

import subprocess
Expand Down
Loading
Loading