PSRule icon indicating copy to clipboard operation
PSRule copied to clipboard

Simplify handling of inputs from files

Open BernieWhite opened this issue 3 years ago • 0 comments

Currently input from files is processed in two ways:

  • As object by using -Format Detect or specific formats such as Json, Yaml, etc...
    • This option reads objects from supported file formats.
  • As file by using -Format File.
  • This option treats files as objects themselves. It doesn't inspect the contents of the files directly however because the file objects are passed through the pipeline conventions can perform additional processing on each file to read or expands objects found within each file.
  • This option also emits repository information as an object.
  • This option also observes .gitignore and Input.PathIgnore options.
  • Files as objects often generate not processed warnings since repositories may not contain any rules that handle file objects directly.

How these options is often a source of confusion and they are not compatible which each other.

We should consolidate these two options into a single input discovery process that is flexible to address the benefits of each method.

Note: Also this should avoid unnecessary warnings that are generated about unprocessed files.

The new discovery process might look like this.

  • Scan for input files based on input path.
  • Apply filters:
    • Exclude .gitignore path specs.
    • Exclude Input.PathIgnore path specs.
    • Custom filtering.
  • Apply expansion:
    • Built-in expansion of supported file types.
    • Custom expansion.

BernieWhite avatar Jul 23 '22 07:07 BernieWhite