From b4aa6f9f8b723995e1e355efb2041a0d0ad03c11 Mon Sep 17 00:00:00 2001
From: Franck Nijhof <git@frenck.dev>
Date: Sun, 5 Jul 2020 02:00:51 +0200
Subject: [PATCH] GitHub Actions: Add pylint problem matcher (#37463)

* GitHub Actions: Add pylint problem matcher

* Create a pylint issue to test

* Create another pylint issue to test

* Register problem matcher in same step

* Apply possible workaround

* Disable problem matcher to catch raw output

* Trying again with new CI containers

* Extend problem matcher with errors and warnings

* Improve matching, keep error code in message

* Revert "Create another pylint issue to test"

This reverts commit a90e23656eaddd4f1c2995572cc39a0d41022a5f.

* Revert "Create a pylint issue to test"

This reverts commit 9dd5148eb4ef74c3261144426d1b0b0f337cb3e5.

* Fix stable name in job description
---
 .github/workflows/ci.yaml              |  3 +++
 .github/workflows/matchers/pylint.json | 32 ++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 .github/workflows/matchers/pylint.json

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 6ff61549746..f641071e3b9 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -631,6 +631,9 @@ jobs:
         run: |
           echo "Failed to restore Python virtual environment from cache"
           exit 1
+      - name: Register pylint problem matcher
+        run: |
+          echo "::add-matcher::.github/workflows/matchers/pylint.json"
       - name: Run pylint
         run: |
           . venv/bin/activate
diff --git a/.github/workflows/matchers/pylint.json b/.github/workflows/matchers/pylint.json
new file mode 100644
index 00000000000..5624ca695c4
--- /dev/null
+++ b/.github/workflows/matchers/pylint.json
@@ -0,0 +1,32 @@
+{
+  "problemMatcher": [
+    {
+      "owner": "pylint-error",
+      "severity": "error",
+      "pattern": [
+        {
+          "regexp": "^(.+):(\\d+):(\\d+):\\s(([EF]\\d{4}):\\s.+)$",
+          "file": 1,
+          "line": 2,
+          "column": 3,
+          "message": 4,
+          "code": 5
+        }
+      ]
+    },
+    {
+      "owner": "pylint-warning",
+      "severity": "warning",
+      "pattern": [
+        {
+          "regexp": "^(.+):(\\d+):(\\d+):\\s(([CRW]\\d{4}):\\s.+)$",
+          "file": 1,
+          "line": 2,
+          "column": 3,
+          "message": 4,
+          "code": 5
+        }
+      ]
+    }
+  ]
+}
-- 
GitLab