diff --git a/.github/elixir-matchers.json b/.github/elixir-matchers.json index e26040d..fefac5f 100644 --- a/.github/elixir-matchers.json +++ b/.github/elixir-matchers.json @@ -41,6 +41,38 @@ "line": 2 } ] + }, + { + "owner": "elixir-credoOutputDefault", + "severity": "warning", + "pattern": [ + { + "regexp": "^\u2503\\s\\[\\w\\]\\s[\u2191|\u2197|\u2192|\u2198|\u2193]\\s(.*)$", + "message": 1 + }, + { + "regexp": "^\u2503\\s{7}(.*):(\\d+):(\\d+)\\s.*$", + "file": 1, + "line": 2, + "column": 3 + } + ] + }, + { + "owner": "elixir-dialyzerOutputDefault", + "severity": "warning", + "pattern": [ + { + "regexp": "^(.*):(\\d+):(.*)", + "file": 1, + "line": 2, + "code": 3 + }, + { + "regexp": "^(.*)$", + "message": 1 + } + ] } ] } diff --git a/__tests__/problem-matchers.test.js b/__tests__/problem-matchers.test.js index 07d14bb..341f507 100644 --- a/__tests__/problem-matchers.test.js +++ b/__tests__/problem-matchers.test.js @@ -5,6 +5,8 @@ async function all() { await testElixirMixCompileError() await testElixirMixCompileWarning() await testElixirMixTestFailure() + await testElixirCredoOutputDefault() + await testElixirDialyzerOutputDefault() } async function testElixirMixCompileError() { @@ -55,6 +57,41 @@ async function testElixirMixTestFailure() { assert.equal(line, '9') } +async function testElixirCredoOutputDefault() { + const [messagePattern, filePattern] = problemMatcher.find( + ({ owner }) => owner === 'elixir-credoOutputDefault', + ).pattern + + const firstOutput = '┃ [F] → Function is too complex (CC is 29, max is 9).' + const secondOutput = '┃ lib/test.ex:15:7 #(Test.hello)' + + const [, message] = firstOutput.match(messagePattern.regexp) + assert.equal(message, 'Function is too complex (CC is 29, max is 9).') + + const [, file, line, column] = secondOutput.match(filePattern.regexp) + assert.equal(file, 'lib/test.ex') + assert.equal(line, '15') + assert.equal(column, '7') +} + +async function testElixirDialyzerOutputDefault() { + const [messagePattern, filePattern] = problemMatcher.find( + ({ owner }) => owner === 'elixir-dialyzerOutputDefault', + ).pattern + + const firstOutput = 'lib/test.ex:15:invalid_contract' + const secondOutput = + 'The @spec for the function does not match the success typing of the function.' + + const [, file, line, code] = firstOutput.match(messagePattern.regexp) + assert.equal(file, 'lib/test.ex') + assert.equal(line, '15') + assert.equal(code, 'invalid_contract') + + const [, message] = secondOutput.match(filePattern.regexp) + assert.equal(message, secondOutput) +} + all() .then(() => process.exit(0)) .catch((err) => { diff --git a/dist/.github/elixir-matchers.json b/dist/.github/elixir-matchers.json index e26040d..fefac5f 100644 --- a/dist/.github/elixir-matchers.json +++ b/dist/.github/elixir-matchers.json @@ -41,6 +41,38 @@ "line": 2 } ] + }, + { + "owner": "elixir-credoOutputDefault", + "severity": "warning", + "pattern": [ + { + "regexp": "^\u2503\\s\\[\\w\\]\\s[\u2191|\u2197|\u2192|\u2198|\u2193]\\s(.*)$", + "message": 1 + }, + { + "regexp": "^\u2503\\s{7}(.*):(\\d+):(\\d+)\\s.*$", + "file": 1, + "line": 2, + "column": 3 + } + ] + }, + { + "owner": "elixir-dialyzerOutputDefault", + "severity": "warning", + "pattern": [ + { + "regexp": "^(.*):(\\d+):(.*)", + "file": 1, + "line": 2, + "code": 3 + }, + { + "regexp": "^(.*)$", + "message": 1 + } + ] } ] }