Skip to content

Rule request: Get-Content x | ConvertFrom-Json should suggest adding -raw for Get-content #1951

@jessehouwing

Description

@jessehouwing

Summary of the new feature

When you call get-content file.json | convertfrom-json, funny things happen when file.json contains a comment at the top of the file.

Multiple places suggest that it's better to use get-content -raw for performance and predictability.

See:

Proposed technical implementation details (optional)

When get-content is piped to convertfrom-*, PSScriptAnalyzer should suggest adding -raw to get-content.

The same could apply to [xml] get-content file.xml.

What is the latest version of PSScriptAnalyzer at the point of writing

1.21

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions