Project

General

Profile

Actions

action #58100

open

HashKeyQuotes: force no quotes for names containing "_"

Added by cfconrad almost 5 years ago. Updated about 4 years ago.

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

0%

Estimated time:

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
Actions #1

Updated by okurz almost 5 years ago

  • Status changed from New to Feedback
  • Assignee set to cfconrad
Actions #2

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.

Actions #3

Updated by cfconrad almost 5 years ago

  • Assignee changed from cfconrad to okurz
Actions #4

Updated by okurz almost 5 years ago

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

ok

Actions #5

Updated by okurz about 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 :)

Actions #6

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".

Actions

Also available in: Atom PDF