Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(FEAT) Add function parsepson #1259

Merged

Conversation

david22swan
Copy link
Member

@david22swan david22swan commented Jul 25, 2022

This commit adds a new function to parse PSON formatted JSON.
This functionality was formally covered by parsejson which, despite its name, defaulted to PSON.
However this has been changed so that the function now accurately uses JSON, with this function covering the potential need for PSON too specifically be used.

@david22swan david22swan requested a review from a team as a code owner July 25, 2022 14:36
@puppet-community-rangefinder
Copy link

parsepson is a function

that may have no external impact to Forge modules.

This module is declared in 318 of 579 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

Copy link
Collaborator

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be written as a modern function rather than the legacy one? You also have parsejson in the PR title and commit message, which should be parsepson.

@david22swan david22swan force-pushed the feat/main/add_function_parsepson branch from 729ef62 to bdf9e36 Compare July 25, 2022 14:41
@david22swan
Copy link
Member Author

Had just copied the original function pre changes, but modernizing it would probably be good.
As for the PR and Commit................ yeh
It was a long day

@david22swan david22swan force-pushed the feat/main/add_function_parsepson branch 3 times, most recently from 3f1b791 to 1cd4ec5 Compare July 26, 2022 08:52
@david22swan david22swan changed the title (FEAT) Add function parsejson (FEAT) Add function parsepson Jul 26, 2022
@david22swan david22swan force-pushed the feat/main/add_function_parsepson branch from 1cd4ec5 to c3ad329 Compare July 26, 2022 08:54
lib/puppet/functions/parsepson.rb Outdated Show resolved Hide resolved
lib/puppet/functions/parsepson.rb Outdated Show resolved Hide resolved
@david22swan david22swan force-pushed the feat/main/add_function_parsepson branch 2 times, most recently from f74a389 to fa64f90 Compare July 26, 2022 10:12
ekohl
ekohl previously approved these changes Jul 26, 2022
This commit adds a new function to parse PSON formatted JSON.
This functionality was formally covered by `parsejson` which, despite its name, defaulted to PSON.
However this has been changed so that the function now accurately uses JSON, with this function being added to cover the potential need for PSON too specifically be used.
@david22swan david22swan force-pushed the feat/main/add_function_parsepson branch from 99a9254 to 0f032a9 Compare July 26, 2022 13:31
Copy link
Contributor

@pmcmaw pmcmaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as failing spec tests are currently present on main.
Following ekohls suggestion of using the newer function style this is something on the teams radar and will be addressed as soon as we have bandwidth.

@pmcmaw pmcmaw merged commit 95cf780 into puppetlabs:main Jul 26, 2022
@ekohl
Copy link
Collaborator

ekohl commented Jul 26, 2022

Following ekohls suggestion of using the newer function style this is something on the teams radar and will be addressed as soon as we have bandwidth.

That's good, but IMHO we should at least only add new style functions (as we did here). Conversion is lower priority.

@alexjfisher
Copy link
Collaborator

Following ekohls suggestion of using the newer function style this is something on the teams radar and will be addressed as soon as we have bandwidth.

That's good, but IMHO we should at least only add new style functions (as we did here). Conversion is lower priority.

And possibly also only allow new functions if they are namespaced too?

@david22swan david22swan deleted the feat/main/add_function_parsepson branch July 27, 2022 13:41
@ekohl
Copy link
Collaborator

ekohl commented Jul 28, 2022

I feel stdlib is always a bit different. All other modules should certainly only have namespaced functions but stdlib is in this weird place. Perhaps best to discuss it in its own issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants