kenyee
(Ken Yee)
October 6, 2020, 1:24pm
1
Must-share information (formatted with Markdown ):
Sonarqube 7.9.1
Trying to understand what valid characters are in Issue’s Key field so I can write a regex for it
I think this works but I had to add “-” recently because I didn’t notice some keys included a dash: ([\w_-]+)
Wanted to confirm this is correct and these are the only valid characters.
ganncamp
(G Ann Campbell)
October 6, 2020, 6:36pm
2
Hi,
Could you give a little more context on this? What specific rule and language are we talking about?
Ann
kenyee
(Ken Yee)
October 6, 2020, 7:02pm
3
Not sure it matters which language?
It’s the REST API for Sonarqube. You download a list of issues… each issue has an Issue Key…
ken
ganncamp
(G Ann Campbell)
October 6, 2020, 7:29pm
4
Ah! Okay! Context helps.
Have you tried looking at the Response Example in the onboard web service documentation? (You’ll find a link in your page footer.) This looks like a GUID to me, i.e. automatically generated, so we probably can’t easily give you a comprehensive character class.
Ann
kenyee
(Ken Yee)
October 6, 2020, 7:43pm
5
{
“key”: “issue”,
“description”: “Issue key”,
“required”: true,
“internal”: false,
“exampleValue”: “AU-Tpxb–iU5OvuD2FLy”
},
Notice that it didn’t say underscores are allowed but they apparently are from my testing.
I was hoping you’d know since you have the source code and Sonarqube is generating these keys
ganncamp
(G Ann Campbell)
October 7, 2020, 12:18pm
6
Hi,
I’m not familiar with the code, but I can almost guarantee you that we’re using a standard function or library for GUID generation.
Ann
kenyee
(Ken Yee)
October 7, 2020, 12:37pm
7
a standard guid looks like this:
https://en.wikipedia.org/wiki/Universally_unique_identifier
So Sonarqube’s issue key is definitely not standard. It has underscores in it for one…and there are no sections like a standard UUID FYI.