Skip to content

Add lint for intended duplicate content, that would be skipped #17

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JoshuaBehrens
Copy link

I wanted to add some content to a yaml at different places.

To not have the same content duplicated I used yaml pointers. When adding the yaml pointer references at multiple places this line hits: https://github.com/symfony/flex/blob/8ce1acd9842abe0e9b4c4a0bd3f259859516c018/src/Configurator/AddLinesConfigurator.php#L171-L173
It will prevent the additional references to be added as the content is already in the file. It will not print a hint as it is the intended check for a change, that might not have to be applied.

In my case it is intentional and it should be mentioned as early as possible. Therefore I add the check to the manifest lint instead of symfony/flex itself as this will be checked eventually when the recipe has been published already.

Template yaml:

ci.yml

steps:
# steps

trigger:
  branch:
    main:
      # trigger_main
    stage:
      # trigger_stage

Expected result:

 steps:
 # steps
+  - step: &pointer
 
 trigger:
   branch:
     main:
       # trigger_main
+      - step: *pointer
     stage:
       # trigger_stage
+      - step: *pointer

Current result:

 steps:
 # steps
+  - step: &pointer
 
 trigger:
   branch:
     main:
       # trigger_main
+      - step: *pointer
     stage:
       # trigger_stage

I can solve this by having a comment behind the pointer reference usage and to make it unique. But it is such a hassle to debug this until you find this skip so I'd rather be notified about this early :)

 steps:
 # steps
+  - step: &pointer
 
 trigger:
   branch:
     main:
       # trigger_main
+      - step: *pointer # at trigger_main
     stage:
       # trigger_stage
+      - step: *pointer # at trigger_stage

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

Successfully merging this pull request may close these issues.

1 participant