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

Account for Anchor & Alias Tags in yaml Transformer #679

Merged
merged 1 commit into from
Apr 11, 2023

Conversation

jpdakran
Copy link
Member

@jpdakran jpdakran commented Mar 31, 2023

  • Please check if the PR fulfills these requirements
  • Tests for the changes have been added
  • Docs have been added / updated
  • All CI checks are green
  • What kind of change does this PR introduce?

Bug fix - #632

  • What is the current behavior?

There is an issue when the yaml transformer is parsing a yaml file.
Yaml has notions of anchor & and alias * tags. You can mark a section of code with an anchor tag and leverage it somewhere else in the yaml file with the * tags.

This causes duplicate lines in transformer which makes line numbers incorrect for the entire file.

  • What is the new behavior (if this is a feature change)?

When parsing through the yaml file. We keep the nodes as returned by pyyaml. However, when returning the lines from the transformer we trim our list to ignore duplicate line items. It is important we keep the ordering the same as we always want to return the first instance of a line and ignore the later references.

We a line item consists of (key, value, line_number, and line). We should not need to account for duplicates.

This will continue to account for duplicate key, value pairs that are on different lines.

  • Does this PR introduce a breaking change?

No

  • Other information:

@jpdakran jpdakran merged commit 1bf8134 into master Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect Line in Yaml for false positive
2 participants