diff --git a/.github/workflows/backend-docker.yaml b/.github/workflows/backend-docker.yaml index a0635ebd..fe8502bf 100644 --- a/.github/workflows/backend-docker.yaml +++ b/.github/workflows/backend-docker.yaml @@ -15,13 +15,13 @@ jobs: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_TOKEN }} - uses: actions/checkout@v3 - - name: 'Build main' + - name: "Build main" if: ${{ github.ref == 'refs/heads/main' }} working-directory: eap_backend run: | docker build -t turingassuranceplatform/eap_backend:main -f Dockerfile . docker push turingassuranceplatform/eap_backend:main - - name: 'Build dev' + - name: "Build dev" if: ${{ github.ref == 'refs/heads/dev' }} working-directory: eap_backend run: | diff --git a/.github/workflows/backend-style.yaml b/.github/workflows/backend-style.yaml index 8ecc841e..dff2d9f3 100644 --- a/.github/workflows/backend-style.yaml +++ b/.github/workflows/backend-style.yaml @@ -14,5 +14,5 @@ jobs: - name: Install flake8 run: pip install flake8 - name: Run flake8 - run: flake8 . --max-line-length 91 + run: flake8 . --max-line-length 200 working-directory: eap_backend diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ba125e46..f8dd3e7b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,12 +1,35 @@ name: ci on: + workflow_dispatch: + pull_request: push: branches: - - master - main + - develop + release: + types: + - published + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true permissions: contents: write jobs: + pre-commit: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-python@v4 + with: + python-version: "3.x" + - uses: pre-commit/action@v3.0.0 + with: + extra_args: --hook-stage manual --all-files + deploy: runs-on: ubuntu-latest if: github.event.repository.fork == false @@ -22,11 +45,13 @@ jobs: path: .cache restore-keys: | mkdocs-material- - - run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git + - run: + pip install + git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git - name: Build and Deploy working-directory: ./site run: | mkdocs build mkdocs gh-deploy --force env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/frontend-docker.yaml b/.github/workflows/frontend-docker.yaml index d88538bd..8c2643cc 100644 --- a/.github/workflows/frontend-docker.yaml +++ b/.github/workflows/frontend-docker.yaml @@ -15,13 +15,13 @@ jobs: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_TOKEN }} - uses: actions/checkout@v3 - - name: 'Build main' + - name: "Build main" if: ${{ github.ref == 'refs/heads/main' }} working-directory: frontend run: | docker build -t turingassuranceplatform/eap_frontend:main -f Dockerfile . docker push turingassuranceplatform/eap_frontend:main - - name: 'Build dev' + - name: "Build dev" if: ${{ github.ref == 'refs/heads/dev' }} working-directory: frontend run: | diff --git a/.gitignore b/.gitignore index aa5e7c42..b6f12348 100644 --- a/.gitignore +++ b/.gitignore @@ -135,4 +135,4 @@ dmypy.json # Pyre type checker .pyre/ -.DS_Store \ No newline at end of file +.DS_Store diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d972a982..cdedfd1d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,19 +1,58 @@ +ci: + autoupdate_commit_msg: "chore: update pre-commit hooks" + autofix_commit_msg: "style: pre-commit fixes" + repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 - hooks: - - id: check-yaml - - id: end-of-file-fixer - - id: trailing-whitespace -- repo: https://github.com/psf/black - rev: 22.3.0 - hooks: - - id: black - language: python - files: ^eap_backend/ -- repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.6.0 - hooks: - - id: prettier - files: ^frontend/src/ - args: [--write] + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: "v0.0.278" + hooks: + - id: ruff + args: ["--fix", "--show-fixes"] + + - repo: https://github.com/psf/black + rev: "23.3.0" + hooks: + - id: black + language: python + files: ^eap_backend/ + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: "v4.4.0" + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: check-symlinks + # - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: mixed-line-ending + #- id: name-tests-test + # args: ["--pytest-test-first"] + - id: requirements-txt-fixer + - id: trailing-whitespace + + - repo: https://github.com/pre-commit/pygrep-hooks + rev: "v1.10.0" + hooks: + - id: rst-backticks + - id: rst-directive-colons + - id: rst-inline-touching-normal + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v2.7.1" + hooks: + - id: prettier + types_or: [yaml, markdown, html, css, scss, javascript, json] + args: [--prose-wrap=always] + + - repo: https://github.com/asottile/blacken-docs + rev: "1.13.0" + hooks: + - id: blacken-docs + additional_dependencies: [black==23.3.0] + + # - repo: https://github.com/shellcheck-py/shellcheck-py + # rev: "v0.9.0.2" + # hooks: + # - id: shellcheck diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 8ae1c203..55936994 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,34 +1,68 @@ # Code of Conduct -> This document is adapted from the Turing Way's [Code of Conduct](https://github.com/alan-turing-institute/the-turing-way/blob/main/CODE_OF_CONDUCT.md). +> This document is adapted from the Turing Way's +> [Code of Conduct](https://github.com/alan-turing-institute/the-turing-way/blob/main/CODE_OF_CONDUCT.md). ## Our Pledge -We value the participation of every member of our community and want to ensure that every contributor has an enjoyable and fulfilling experience. Accordingly, everyone who contributes to this project or engages the community (e.g. through [discussions](https://github.com/alan-turing-institute/AssurancePlatform/discussions)) is expected to show respect and courtesy to other community members at all times. +We value the participation of every member of our community and want to ensure +that every contributor has an enjoyable and fulfilling experience. Accordingly, +everyone who contributes to this project or engages the community (e.g. through +[discussions](https://github.com/alan-turing-institute/AssurancePlatform/discussions)) +is expected to show respect and courtesy to other community members at all +times. -We are dedicated to a harassment-free experience for everyone, regardless of gender, gender identity and expression, sexual orientation, disability, physical appearance, body size, race, age or religion. -**We do not tolerate harassment by and/or of members of our community in any form.** +We are dedicated to a harassment-free experience for everyone, regardless of +gender, gender identity and expression, sexual orientation, disability, physical +appearance, body size, race, age or religion. **We do not tolerate harassment by +and/or of members of our community in any form.** -Despite having limited resources and a small team, we are motivated to support new and/or anxious collaborators, people who are looking to learn and develop their skills, and anyone who has experienced discrimination in the past. +Despite having limited resources and a small team, we are motivated to support +new and/or anxious collaborators, people who are looking to learn and develop +their skills, and anyone who has experienced discrimination in the past. -To make clear what is expected, we ask all members of the community to conform to the following Code of Conduct. +To make clear what is expected, we ask all members of the community to conform +to the following Code of Conduct. ## Our Standards ### Expected Behaviour -- **Be respectful of different viewpoints and experiences**. Do not engage in homophobic, racist, transphobic, ageist, ableist, sexist, or otherwise exclusionary behaviour. -- **Use welcoming and inclusive language**. Exclusionary comments or jokes, threats or violent language are not acceptable. Do not address others in an angry, intimidating, or demeaning manner. Be considerate of the ways the words you choose may impact others. Be patient and respectful of the fact that English is a second (or third or fourth!) language for some participants. -- **Respect the privacy and safety of others**. Do not take photographs of others without their permission. Do not share other participant’s personal experiences without their express permission. Note that posting (or threatening to post) personally identifying information of others without their consent ("doxing") is a form of harassment. -- **Be considerate of others’ participation**. Everyone should have an opportunity to be heard. In update sessions, please keep comments succinct so as to allow maximum engagement by all participants. Do not interrupt others on the basis of disagreement; hold such comments until they have finished speaking. -- **Don’t be a bystander**. If you see something inappropriate happening, speak up. If you don't feel comfortable intervening but feel someone should, please feel free to ask a member of the Code of Conduct response team for support. -- As an overriding general rule, please **be intentional in your actions and humble in your mistakes**. +- **Be respectful of different viewpoints and experiences**. Do not engage in + homophobic, racist, transphobic, ageist, ableist, sexist, or otherwise + exclusionary behaviour. +- **Use welcoming and inclusive language**. Exclusionary comments or jokes, + threats or violent language are not acceptable. Do not address others in an + angry, intimidating, or demeaning manner. Be considerate of the ways the words + you choose may impact others. Be patient and respectful of the fact that + English is a second (or third or fourth!) language for some participants. +- **Respect the privacy and safety of others**. Do not take photographs of + others without their permission. Do not share other participant’s personal + experiences without their express permission. Note that posting (or + threatening to post) personally identifying information of others without + their consent ("doxing") is a form of harassment. +- **Be considerate of others’ participation**. Everyone should have an + opportunity to be heard. In update sessions, please keep comments succinct so + as to allow maximum engagement by all participants. Do not interrupt others on + the basis of disagreement; hold such comments until they have finished + speaking. +- **Don’t be a bystander**. If you see something inappropriate happening, speak + up. If you don't feel comfortable intervening but feel someone should, please + feel free to ask a member of the Code of Conduct response team for support. +- As an overriding general rule, please **be intentional in your actions and + humble in your mistakes**. ### Unacceptable Behaviour -- Written or verbal comments which have the effect of excluding people on the basis of membership of any specific group. -- Any form of harassment, which includes unwanted physical contact, sexual attention, or repeated social contact. Know that consent is explicit, conscious and continuous—not implied. If you are unsure whether your behaviour towards another person is welcome, ask them. If someone tells you to stop, do so. -- Causing someone to fear for their safety, such as through stalking, following, or intimidation. +- Written or verbal comments which have the effect of excluding people on the + basis of membership of any specific group. +- Any form of harassment, which includes unwanted physical contact, sexual + attention, or repeated social contact. Know that consent is explicit, + conscious and continuous—not implied. If you are unsure whether your behaviour + towards another person is welcome, ask them. If someone tells you to stop, do + so. +- Causing someone to fear for their safety, such as through stalking, following, + or intimidation. - Violent threats or language directed against another person. - The display of sexual or violent images. - Unwelcome sexual attention. @@ -38,14 +72,18 @@ To make clear what is expected, we ask all members of the community to conform t - Sexist, racist, homophobic, transphobic, ableist, or exclusionary jokes. - Excessive swearing. - Incitement to violence, suicide, or self-harm. -- Continuing to initiate interaction (including photography or recording) with someone after being asked to stop. +- Continuing to initiate interaction (including photography or recording) with + someone after being asked to stop. - Publication of private communication without consent. ### Consequences of Unacceptable Behaviour -Participants who are asked to stop any inappropriate behaviour are expected to comply immediately. -If a participant engages in behaviour that violates this Code of Conduct, they will be restricted from further participation or engagement with the platform and community. +Participants who are asked to stop any inappropriate behaviour are expected to +comply immediately. If a participant engages in behaviour that violates this +Code of Conduct, they will be restricted from further participation or +engagement with the platform and community. ### Incident Reporting Guidelines -If you feel able to, please contact Christopher Burr by email at [cburr@turing.ac.uk](mailto:cburrr@turing.ac.uk). +If you feel able to, please contact Christopher Burr by email at +[cburr@turing.ac.uk](mailto:cburrr@turing.ac.uk). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b7746dcc..d53b71ac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,10 +1,12 @@ -# Contributing to the *Assurance Platform* +# Contributing to the _Assurance Platform_ -:tada::smile: **Welcome to the *Assurance Platform* repository!** :smile::tada: +:tada::smile: **Welcome to the _Assurance Platform_ repository!** :smile::tada: -We hope that the information provided in this document will make it as easy as possible for you to get involved. +We hope that the information provided in this document will make it as easy as +possible for you to get involved. -This document explains how you can contribute to the project through this repository and other means of engagement. +This document explains how you can contribute to the project through this +repository and other means of engagement. ## Forms of Contribution @@ -14,7 +16,8 @@ There are several ways you can contribute: 2. Improve our documentation (e.g. fixing typos or reporting bugs) 🪲 3. Support with community building 👥 -The following sections explain each of these forms of contribution in more detail, and offer guidance for contribution in general. +The following sections explain each of these forms of contribution in more +detail, and offer guidance for contribution in general. ## How to Contribute @@ -26,38 +29,53 @@ All forms of contribution can be made through the following mechanisms: - Raising an issue - Opening a thread for discussion -Before doing work or opening a pull request, it would be worth checking our projects page to see how the contribution may align or conflict with proposed work. +Before doing work or opening a pull request, it would be worth checking our +projects page to see how the contribution may align or conflict with proposed +work. -Before raising an issue, please check the open and closed issues to avoid duplication. +Before raising an issue, please check the open and closed issues to avoid +duplication. -Before opening a new thread for discussion, please check for existing threads that cover the same or similar points to avoid duplication. +Before opening a new thread for discussion, please check for existing threads +that cover the same or similar points to avoid duplication. ### Contributing to our Code -*To be written.* +_To be written._ ### Contributing to the Documentation -We use [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) to generate our documentation site. -All documentation is written in markdown, and any contributions should be made following this format. - -If you are new to Markdown, GitHub has a helpful page on [getting started with writing and formatting on GitHub](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github). -And, the [documentation for Material for MkDocs](https://squidfunk.github.io/mkdocs-material/reference/) also has excellent support on additional syntax and styling. - -When writing in Markdown, please start each new sentence on a new line. -Having each sentence on a new line will make no difference to how the text is displayed, there will still be paragraphs, but it makes the [diffs produced during the pull request](https://help.github.com/en/articles/about-comparing-branches-in-pull-requests) review easier to read! :sparkles: - -We are grateful for all suggestions and contributions. -This can include typos, content issues (e.g. missing references, false or problematic statements), improvements to our community documentation (e.g. README files), and any technical issues (e.g. problems with pages not rendering correctly, or improvements to the code base). -If you are unsure of whether a more substantive contribution is likely to be accepted (e.g. new section), please feel free to reach out in advance (e.g. open a new issue or discussion). +We use [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) to +generate our documentation site. All documentation is written in markdown, and +any contributions should be made following this format. + +If you are new to Markdown, GitHub has a helpful page on +[getting started with writing and formatting on GitHub](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github). +And, the +[documentation for Material for MkDocs](https://squidfunk.github.io/mkdocs-material/reference/) +also has excellent support on additional syntax and styling. + +When writing in Markdown, please start each new sentence on a new line. Having +each sentence on a new line will make no difference to how the text is +displayed, there will still be paragraphs, but it makes the +[diffs produced during the pull request](https://help.github.com/en/articles/about-comparing-branches-in-pull-requests) +review easier to read! :sparkles: + +We are grateful for all suggestions and contributions. This can include typos, +content issues (e.g. missing references, false or problematic statements), +improvements to our community documentation (e.g. README files), and any +technical issues (e.g. problems with pages not rendering correctly, or +improvements to the code base). If you are unsure of whether a more substantive +contribution is likely to be accepted (e.g. new section), please feel free to +reach out in advance (e.g. open a new issue or discussion). ### Support with Community Building -*To be added.* +_To be added._ ## Recognising Contributions -*To be added.* +_To be added._