PS: Remove spurious Pipelines in the DB
#100
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pipelineelements appear implicitly in a lot of places in Powershell. For example, in something like:This looks like an assignment where the right-hand side is a
Cmd, but it's actually an assignment where the right-hand side is aPipelinecontaining a single element: ACmd.This is an artifact from the Powershell parser, and from a query-writing perspective is very confusing. So this PR removes
Pipelines containing only a single element. This means that the right-hand of$a = MyFoo-42actually is aCmd. However, if one were to write something like$a = My-Foo 42 | MyBar "abc"then we'd have aPipelineon the right-hand side as expected.The first commit updates the extractor to skip
Pipelines when they wrap a single element. Most of the touched files are because we had to change the way we generate theparentrelation such that it skips single-elementPipelines. For example, the parent ofMy-Foo 42 in$a = My-Foo 42isn't thePipeline(since we don't extract single-elementPipelinesanymore), but rather the parent of thatPipeline`.The next commit fixes up the GitHub script for generating up- and down-grade scripts to also work on Powershell, and the next commit runs the script to generate the up- and down-grade scripts. It's probably possible to generate a better up- and down-grade script pair that improves analyses on old databases, but I don't think it's really worth it since we don't actually run a lot of Powershell analysis yet.
The final commit accepts the test changes. This is simple removal of elements that are no longer in the database.