Need Regex to match key in Yaml file

Hi,

SonarQube v7.9

I am trying to identify the key in the YAML file with the help of the Yaml Template providing by default ( YAML documents should not contain some keys)

I need to flag the issue on logging: file and I have tried using regex 1 but no success
When I tried with Regex 2, instead of flagging the error on a particular key contains config: uri, it was flagging on the remaining keys next to it

Regex 1: .logging:+\s+file.
Regex 2: ^[config:+\s+uri]*

Can you please help me on regex to flag a particular key only once in the entire YAML file.

Sample yaml file:

spring:
 security:
    user:
      name:     
 cloud:
    config:
      uri:
      -
logging:
  file: ./fromYaml.log

Thanks,

Hi,

Welcome to the community!

YAML analysis isn’t supported directly by SonarSource, but by a community plugin. You’ll probably do best to open an issue on that project.

 
HTH,
Ann