[refactor] Simplify regex

This commit is contained in:
olemorud
2023-03-16 14:46:36 +01:00
parent 4c3b4df0ad
commit 8f0e275979
3 changed files with 4 additions and 9 deletions

View File

@@ -4,7 +4,7 @@
"owner": "gcc-problem-matcher",
"pattern": [
{
"regexp": "^.*?${{ BASE }}\/?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
"regexp": "^\\s*${{ BASE }}\/?(.*?):(\\d+):(\\d+):.*?(warning|error): (.*)$"
"file": 1,
"line": 2,
"column": 3,

9
dist/index.js vendored
View File

@@ -2862,18 +2862,13 @@ const templatePath = __nccwpck_require__.ab + "gcc_matcher.jsontemplate";
const matcherPath = __nccwpck_require__.ab + "gcc_matcher.json";
// rootdir :: string
const rootdir = () =>
core.getInput('build-directory', {required: false});
const rootdir = core.getInput('build-directory', {required: false});
// parse :: IO() => IO() => Error | null
const parse = (templatePath) => (matcherPath) => {
const r = rootdir();
console.log(r);
const content = fs.readFileSync(templatePath, 'utf-8');
const parsed = content.replace(variable("BASE"), escapeRegExp(rootdir()));
const parsed = content.replace(variable("BASE"), escapeRegExp(rootdir));
fs.writeFileSync(matcherPath, parsed);

View File

@@ -4,7 +4,7 @@
"owner": "gcc-problem-matcher",
"pattern": [
{
"regexp": "^.*?${{ BASE }}\/?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
"regexp": "^\\s*${{ BASE }}\/?(.*?):(\\d+):(\\d+):.*?(warning|error): (.*)$"
"file": 1,
"line": 2,
"column": 3,