action #58100
openHashKeyQuotes: force no quotes for names containing "_"
0%
Description
Motivation¶
Currently we allow quotes for names containing "". From perl perspective a name containing '' is still a simple identifier and can be used without quotes for hashkey.
From https://perldoc.perl.org/perldata.html :
The => operator is mostly just a more visually distinctive synonym for a comma, but it also arranges
for its left-hand operand to be interpreted as a string if it's a bareword that would be a legal simple
identifier.
So we will end up with a regex like this:
/^[a-zA-Z][0-9a-zA-Z_]*$/
Changing it, produce perlcritic violations, so a cleanup is needed as well.
Acceptance criteria¶
- AC1: hash keys containing
_
are accepted without surrounding quotes - AC2: Adopted tidy rules have been applied to os-autoinst and downstream os-autoinst-distri-opensuse
Suggestions¶
- Change existing tidy checks within os-autoinst
- Ensure os-autoinst code adheres to the new rules
- Apply the same for os-autoinst-distri-opensuse
Updated by okurz almost 5 years ago
- Status changed from New to Feedback
- Assignee set to cfconrad
@cfconrad did you solve this now yourself with https://github.com/os-autoinst/os-autoinst/pull/1223/files#diff-838517ce7f3788eb66e3542a57c722fcR26 or what is missing?
Updated by cfconrad almost 5 years ago
Hi Okurz,
no, it is not solved. You would need to add a _
into the regex so it looks like m/^(["'])[a-zA-Z][0-9a-zA-Z_]*\1$/;
. But if you are doing it, we will face some perlcritic violations and I wasn't sure if os-autoinst project want to have this change.
Updated by okurz over 4 years ago
- Subject changed from [tools] HashKeyQuotes: force no quotes for names containing "_" to HashKeyQuotes: force no quotes for names containing "_"
- Description updated (diff)
- Status changed from New to Workable
- Target version set to Ready
I am sure our perl gurus will arrive at a solution quickly :)
Updated by okurz about 4 years ago
- Target version changed from Ready to future
well, not so quickly ;)
It's a good idea though no heavy use case behind. Everyone outside SUSE QA Tools should be able to solve this as well and SUSE QA Tools team has low capacity, hence removing from "Ready".