What flavor of regular expression does SonarQube support for rules?

Trying to update python:S1451 to comply with are header files for python to match.

#!/usr/bin/env python3
# Copyright © X

or

# Copyright © X

Rule: (^#!/usr/bin/env python3[\r\n]{1,2})?(^# Copyright \xA9 LFV$)

It matches when I try it on regex101.com with PCRE2.

But, I still get issues for python:S1451.

  1. What regexp flavour does SonarQube use?
  2. Is there a way to test the regexp with SonarQube?

BR,
Jimisola

Hello,

The Python analyzer is written in Java, so try to select Java at regex101. I am not aware of a way to test the regex in SonarQube directly.

You can find the implementation of the rule here, if you are curious.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.