Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-1795

Issue warning for numeric coercion

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.10.2
    • Component/s: Docs, Language
    • Labels:
    • Template:
    • Epic Link:
    • Sub-team:
    • Team:
      Agent
    • Story Points:
      2
    • Sprint:
      PDE 2017-05-31
    • Release Notes:
      Deprecation
    • Release Notes Summary:
      Hide
      Puppet's automatic string to numeric coercion will now output a warning if {{\--strict}} is set to {{warning}} or {{error}} whenever an automatic conversion is triggered directly by logic in a manifest. (Conversions performed by functions or the runtime in general does not generate warnings).
      When getting a warning for something like {{$numstr + 0}} change that logic to one of {{Numeric($numstr), Integer($numstr), Float($numstr)}} depending on the expectations of the produced value (any numeric, an integer, or a float).
      Show
      Puppet's automatic string to numeric coercion will now output a warning if {{\--strict}} is set to {{warning}} or {{error}} whenever an automatic conversion is triggered directly by logic in a manifest. (Conversions performed by functions or the runtime in general does not generate warnings). When getting a warning for something like {{$numstr + 0}} change that logic to one of {{Numeric($numstr), Integer($numstr), Float($numstr)}} depending on the expectations of the produced value (any numeric, an integer, or a float).
    • QA Risk Assessment:
      Manual

      Description

      Right now $a = '10' + 1 coerces '10' into the number 10 without letting anyone know. We want to move to a world where coercions are not done automatically and so we need to start issuing warnings when it occurs so that users can fix the problems.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              henrik.lindberg Henrik Lindberg
              QA Contact:
              Kurt Wall
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support