diff --git a/.github/scripts/check-license.py b/.github/scripts/check-license.py new file mode 100644 index 0000000..3cea057 --- /dev/null +++ b/.github/scripts/check-license.py @@ -0,0 +1,64 @@ +import sys +from pathlib import Path + +REQUIRED_LICENSE = [ + "#", + "# This program is free software: you can redistribute it and/or modify", + "# it under the terms of the GNU Affero General Public License as published", + "# by the Free Software Foundation, either version 3 of the License, or", + "# (at your option) any later version.", + "#", + "# This program 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 Affero General Public License for more details.", + "#", + "# You should have received a copy of the GNU Affero General Public License", + "# along with this program. If not, see ." +] + +SOURCE_EXTS = {".py", ".js", ".ts", ".java", ".c", ".cpp", ".go", ".rs"} + +IGNORE_DIRS = { + "docs", + ".github" +} +IGNORE_FILES = { + "LICENSE", + "mkdocs.yml", + ".readthedocs.yml", + ".gitignore" + +} + +def check_file(path): + try: + with open(path, "r", encoding="utf-8") as f: + lines = [line.rstrip("\n") for line in f.readlines()] + except UnicodeDecodeError: + return True + if len(lines) < len(REQUIRED_LICENSE) + 2: + return False + + return lines[2:2+len(REQUIRED_LICENSE)] == REQUIRED_LICENSE + +def main(): + failed_files = [] + for file_path in Path(".").rglob("*"): + if ( + file_path.is_file() + and file_path.suffix in SOURCE_EXTS + and not any(part in IGNORE_DIRS for part in file_path.parts) + and file_path.name not in IGNORE_FILES + ): + if not check_file(file_path): + failed_files.append(str(file_path)) + + if failed_files: + print("License header check failed for these files:") + for f in failed_files: + print(f" - {f}") + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/.github/workflows/check-license.yml b/.github/workflows/check-license.yml new file mode 100644 index 0000000..e65016d --- /dev/null +++ b/.github/workflows/check-license.yml @@ -0,0 +1,22 @@ +name: Check License +permissions: + contents: read + +on: + pull_request: + branches: [ main, dev, testing ] + +jobs: + license-check: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Run license check + run: python .github/scripts/check-license.py \ No newline at end of file diff --git a/README.md b/README.md index 1229bd2..6054779 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ A Flask-based webapp for (book) library management, with reserves, loans, renewa Can run on a locally hosted server. -## Wiki -[Home](https://github.com/The-CS-Nerds/Library-System/wiki) -[Installation](https://github.com/The-CS-Nerds/Library-System/wiki/Installation) +## Documentation: + +See our [**read the docs page**](https://library-system.readthedocs.io/en/latest/) ## Versions Currently in development. diff --git a/Tech-Stack.md b/Tech-Stack.md deleted file mode 100644 index e817235..0000000 --- a/Tech-Stack.md +++ /dev/null @@ -1,2 +0,0 @@ -# Review -This file outlines the Tech Stack reqired to run this system \ No newline at end of file diff --git a/secrets/casbin_login_pass.txt b/secrets/casbin_login_pass.txt deleted file mode 100644 index 3987384..0000000 --- a/secrets/casbin_login_pass.txt +++ /dev/null @@ -1 +0,0 @@ -U8yrwoV5TahUagOK67ZcXsNcB9RDWbqDgcJH9z4PZSoT1TI3h-4VvNDyJUuSHQUM5rBeGZVVBTGjKefaMvEfhuR7dH7XXdTrqDcNYRwOfBkan2R2J9c1uwE-voKMO0LVM9KK5PbR3-DZZVM5eq_nhJFZKws3t-X96FA_o1hT8IYdW8M374D3rtFSEkJLIzPQGq2Y8lZLigGXvyP6gM88640rDBiSMS4moR9IZjdecgpsO8LtvtxTe7hT037x2zTq1cNY-EkeceU41SSLFmfErVcihLAE0L3GGiOSuU8rMitsSTi6YjmcSoinjVlSvin2DjI5RlkRh3sRYrf5AlXRALXGo9z3bugAQxlMDywWS-kGrl9VsyuGmcON6rObSjbal4mfkcFm8OL3mEBvXUCJrvvdySQVUqj9_e4lU0Z96gZJGr3ZyjQQYQe2gaDhTLfpDQHWz5XcRVZdby0jcjB2XpfykUrwouaiv-HEZTG7d2hxtKkSZzIkVMlH7FVgjFdNGihbL5zsdomCbzeqsvx5E1ZmZw1EAjTrROFeyhpVIXW7DSMbU5mMrHIyJ0PZV5fOTpq59O96EWQ9DUiP8-WCUKlx7FQ9f12a6rqqHVAemFGUCSA-OXsXbF8FPIb8P-Qc4Xp_Rb22AmX5QGyCUWBA0LGJMluESmPwHdZE2kp3geY \ No newline at end of file diff --git a/secrets/db_pass.txt b/secrets/db_pass.txt deleted file mode 100644 index 049bf23..0000000 --- a/secrets/db_pass.txt +++ /dev/null @@ -1 +0,0 @@ -WDSRzs-ntb2JTxU8cPeYrs-fDsPZMd4OeAAsy-lrBppOfDvNjwGzbSdQsfsM9tjNX3U03smUaQrEaOhLRIA83rkMq3OymNs2QGCwsT72qOuuF3Mo-PSpwXvjPFSbbtJvX9sMHMru1j-7hpc90JlV4hHOKL0z0LwBxbfHG_i6Y-Y6bfTzmzMzu663iPROGPIe3FszLlf-2XRH-tFoqojj3tV2PHMKKC6CHGHNiLN3tN6Cza6L2yXdZ6V_3EbQyQ0tPJwx0chAy1ljL_fDsnizFDW5zZsSPumy5nnbjeMEmkVAtYWZ34Daq_gD_yRm-mlhTJ6lNaC3dlxkYlfsWwNp71ru41SHtZroGabCDIcvMT4iwyTpoofoWssu4DeK65McIAtRmE1YG8nNqci3U2dZMM5ckpdnE1zJJa8q1Y5xwn7A954ZdRWFBVDZhEGY7pxwhAw0FhOm_tEK90aWQDWZCP6Vpj6EEwbLHflXEWBywI88BDuFOHnix1jc6V6zAgl_mkZHfzB3lfFT6HGhV1rkz1ZxBDGgMh3k8KTs8X2WYxcM0ehcvZ7ICQznYVM1FG9XJu5tISYLcHPPtpoiLFPfvD64sZ1cd87kk1ZPuySqkQ16GHNFfb2uYqDbUUTUOwVv7zauSi0C7Sty2lcvictxqis2FNNHpZ1JaZC0zjfkK4U \ No newline at end of file