Project

General

Profile

action #58100

HashKeyQuotes: force no quotes for names containing "_"

Added by cfconrad over 1 year ago. Updated 7 months ago.

Status:
Workable
Priority:
Low
Assignee:
-
Category:
Feature requests
Target version:
Start date:
2019-10-14
Due date:
% Done:

0%

Estimated time:
Difficulty:

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

History

#1 Updated by okurz over 1 year ago

  • Status changed from New to Feedback
  • Assignee set to cfconrad

#2 Updated by cfconrad over 1 year 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.

#3 Updated by cfconrad over 1 year ago

  • Assignee changed from cfconrad to okurz

#4 Updated by okurz over 1 year ago

  • Status changed from Feedback to New
  • Assignee deleted (okurz)

ok

#5 Updated by okurz 9 months 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 :)

#6 Updated by okurz 7 months 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".

Also available in: Atom PDF