Skip to content

Should this format work? #50

@mrchief

Description

@mrchief

Given this error log:

FAILURE: Schema [/github/workspace/schemas/meta-info/jsonschema/1-0-0] contains following errors:
1. error: "objecta" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])
    level: "error"
    domain: "syntax"
    schema: {"loadingURI":"#","pointer":""}
    keyword: "type"
    found: "objecta"
    valid: ["array","boolean","integer","null","number","object","string"]

2. Error: JSON Schema [iglu:root/meta-info/jsonschema/1-0-0] doesn't conform path [schemas/meta-info/jsonschema/1-0-0]
FAILURE: Schema [/github/workspace/schemas/view_info/jsonschema/1-0-0] contains following errors:
1. Error: JSON Schema [iglu:root/view_info/jsonschema/1-0-0] doesn't conform path [schemas/view_info/jsonschema/1-0-0]
FAILURE: Schema [/github/workspace/schemas/page_info/jsonschema/1-0-0] contains following errors:
1. error: "String" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])
    level: "error"
    domain: "syntax"
    schema: {"loadingURI":"#","pointer":"/properties/page_access"}
    keyword: "type"
    found: "String"
    valid: ["array","boolean","integer","null","number","object","string"]

2. Error: JSON Schema [iglu:root/page_info/jsonschema/1-0-0] doesn't conform path [schemas/page_info/jsonschema/1-0-0]
FAILURE: Schema [/github/workspace/schemas/user_info/jsonschema/1-0-0] contains following errors:
1. Error: JSON Schema [iglu:root/user_info/jsonschema/1-0-0] doesn't conform path [schemas/user_info/jsonschema/1-0-0]
TOTAL: 0 Schemas were successfully validated
TOTAL: 4 invalid Schemas were encountered
TOTAL: 6 errors were encountered

and errorformat string

%EFAILURE:\ Schema\ [%-P%f]%.%#,%#.\ %m,%C%.%#,%-G%.%#

the playground can parse errors correctly

[
  {
    "filename": "/github/workspace/schemas/meta-info/jsonschema/1-0-0",
    "lnum": 0,
    "col": 0,
    "vcol": false,
    "nr": 0,
    "pattern": "",
    "text": "error: \"objecta\" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])",
    "type": 0,
    "valid": true,
    "lines": [
      "1. error: \"objecta\" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])"
    ]
  },
  {
    "filename": "/github/workspace/schemas/meta-info/jsonschema/1-0-0",
    "lnum": 0,
    "col": 0,
    "vcol": false,
    "nr": 0,
    "pattern": "",
    "text": "Error: JSON Schema [iglu:root/meta-info/jsonschema/1-0-0] doesn't conform path [schemas/meta-info/jsonschema/1-0-0]",
    "type": 0,
    "valid": true,
    "lines": [
      "2. Error: JSON Schema [iglu:root/meta-info/jsonschema/1-0-0] doesn't conform path [schemas/meta-info/jsonschema/1-0-0]"
    ]
  },
  {
    "filename": "/github/workspace/schemas/view_info/jsonschema/1-0-0",
    "lnum": 0,
    "col": 0,
    "vcol": false,
    "nr": 0,
    "pattern": "",
    "text": "Error: JSON Schema [iglu:root/view_info/jsonschema/1-0-0] doesn't conform path [schemas/view_info/jsonschema/1-0-0]",
    "type": 0,
    "valid": true,
    "lines": [
      "1. Error: JSON Schema [iglu:root/view_info/jsonschema/1-0-0] doesn't conform path [schemas/view_info/jsonschema/1-0-0]"
    ]
  },
  {
    "filename": "/github/workspace/schemas/page_info/jsonschema/1-0-0",
    "lnum": 0,
    "col": 0,
    "vcol": false,
    "nr": 0,
    "pattern": "",
    "text": "error: \"String\" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])",
    "type": 0,
    "valid": true,
    "lines": [
      "1. error: \"String\" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])"
    ]
  },
  {
    "filename": "/github/workspace/schemas/page_info/jsonschema/1-0-0",
    "lnum": 0,
    "col": 0,
    "vcol": false,
    "nr": 0,
    "pattern": "",
    "text": "Error: JSON Schema [iglu:root/page_info/jsonschema/1-0-0] doesn't conform path [schemas/page_info/jsonschema/1-0-0]",
    "type": 0,
    "valid": true,
    "lines": [
      "2. Error: JSON Schema [iglu:root/page_info/jsonschema/1-0-0] doesn't conform path [schemas/page_info/jsonschema/1-0-0]"
    ]
  },
  {
    "filename": "/github/workspace/schemas/user_info/jsonschema/1-0-0",
    "lnum": 0,
    "col": 0,
    "vcol": false,
    "nr": 0,
    "pattern": "",
    "text": "Error: JSON Schema [iglu:root/user_info/jsonschema/1-0-0] doesn't conform path [schemas/user_info/jsonschema/1-0-0]",
    "type": 0,
    "valid": true,
    "lines": [
      "1. Error: JSON Schema [iglu:root/user_info/jsonschema/1-0-0] doesn't conform path [schemas/user_info/jsonschema/1-0-0]"
    ]
  }
]

But the CLI tool

cat err.log | errorformat '%EFAILURE:\ Schema\ [%-P%f]%.%#,%#.\ %m,%C%.%#,%-G%.%#'  

doesn't output the filename properly:

|| FAILURE: Schema [/github/workspace/schemas/meta-info/jsonschema/1-0-0] contains following errors:
|| 1. error: "objecta" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])
||     level: "error"
||     domain: "syntax"
||     schema: {"loadingURI":"#","pointer":""}
||     keyword: "type"
||     found: "objecta"
||     valid: ["array","boolean","integer","null","number","object","string"]
||
|| 2. Error: JSON Schema [iglu:root/meta-info/jsonschema/1-0-0] doesn't conform path [schemas/meta-info/jsonschema/1-0-0]
|| FAILURE: Schema [/github/workspace/schemas/view_info/jsonschema/1-0-0] contains following errors:
|| 1. Error: JSON Schema [iglu:root/view_info/jsonschema/1-0-0] doesn't conform path [schemas/view_info/jsonschema/1-0-0]  
|| FAILURE: Schema [/github/workspace/schemas/page_info/jsonschema/1-0-0] contains following errors:
|| 1. error: "String" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])
||     level: "error"
||     domain: "syntax"
||     schema: {"loadingURI":"#","pointer":"/properties/page_access"}
||     keyword: "type"
||     found: "String"
||     valid: ["array","boolean","integer","null","number","object","string"]
||
|| 2. Error: JSON Schema [iglu:root/page_info/jsonschema/1-0-0] doesn't conform path [schemas/page_info/jsonschema/1-0-0]
|| FAILURE: Schema [/github/workspace/schemas/user_info/jsonschema/1-0-0] contains following errors:
|| 1. Error: JSON Schema [iglu:root/user_info/jsonschema/1-0-0] doesn't conform path [schemas/user_info/jsonschema/1-0-0]
|| TOTAL: 0 Schemas were successfully validated
|| TOTAL: 4 invalid Schemas were encountered
|| TOTAL: 6 errors were encountered

README says ...but it doesn't support Vim regex. but I see this too

efm, _ := errorformat.NewErrorformat([]string{`%f:%l:%c: %m`, `%-G%.%#`})

which is using a regex pattern %.%#.

Not a vim user and up until yesterday, I had no idea what an errorformat was. So I'm not sure what's going on here.

The ultimate issue is that reviewdog is not reporting any findings despite errors so I'm trying to debug that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions