From 31c1fb65135939a9940183357a4ad68589d81bb4 Mon Sep 17 00:00:00 2001 From: Jorge <46056498+jorgectf@users.noreply.github.com> Date: Mon, 3 Jul 2023 09:12:39 +0200 Subject: [PATCH 01/21] Add CodeQL workflow --- .github/workflows/codeql.yml | 65 ++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..0729ea9ef --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,65 @@ +name: "CodeQL" + +on: + push: + branches: [ 'master' ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ 'master' ] + schedule: + - cron: '38 19 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" From bef287cd80b1ab1996f5adf021e4d2ceb22533aa Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Thu, 20 Jul 2023 10:55:58 +0100 Subject: [PATCH 02/21] Update isort pre-commit installation I couldn't get it working as-was, so I stole the config from Textual and it works. --- .pre-commit-config.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 75b988eb6..1d27aae3f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,9 +35,10 @@ repos: hooks: - id: black exclude: ^benchmarks/ - - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + - repo: https://github.com/pycqa/isort + rev: 5.12.0 hooks: - id: isort - exclude: ^benchmarks/ + name: isort (python) + language_version: '3.11' args: ["--profile", "black"] From 3089e9fb8a9363c64da144f324e668ad0b957ca9 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Thu, 20 Jul 2023 10:56:32 +0100 Subject: [PATCH 03/21] Move the tag to before the in the export template See #3021 --- rich/_export_format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rich/_export_format.py b/rich/_export_format.py index 094d2dc22..998a9b0de 100644 --- a/rich/_export_format.py +++ b/rich/_export_format.py @@ -1,5 +1,6 @@ CONSOLE_HTML_FORMAT = """\ + -
{code}
From 3cf74dd1ae9fd03788d0cf4eb168246d33dd5a6e Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Thu, 20 Jul 2023 11:09:44 +0100 Subject: [PATCH 04/21] Update the export tests for the new template --- tests/test_console.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_console.py b/tests/test_console.py index 990dce143..a3b73793c 100644 --- a/tests/test_console.py +++ b/tests/test_console.py @@ -529,7 +529,7 @@ def test_export_html(): console.print("[b]foo