question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove first line `---`

See original GitHub issue

Proposal: Remove --- from the top of each YAML file, if it does not start with a front matter block

Author: Your Name <@lucendio>

Date: 2019-09-01

  • Status: New
  • Proposal type: file syntax
  • Estimated time to implement: 2 days

Motivation

One way to use Molecule is to start by generating a skeleton. This results in a lot of files starting with a line that is not needed in most cases.

Problems

This first line (---) is unnecessary in most cases and can lead to confusion by the reader as well as to inconsistency in the project where Molecule generates code into.

Solution proposal

Remove the first line consisting of --- from each YAML file that does not start with a front matter or contains multiple YAML documents.

Dependencies

Possibly the (version of the) YAML parser being used by Ansible.

Testing

Use existing test facilities to see if something breaks.

Documentation

Probably referring to Ansible Docs: YAML Syntax, which states that this line is optional.

Anything else?

N/A

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
cognifloydcommented, Sep 29, 2020

Odd. I have always made sure that --- is in all my yaml documents. I like the consistency across all files. If I don’t see the --- then I have to double check the line number to see if I’m at the top of the file or check my history to make sure I didn’t inadvertently delete it. It’s interesting to see when opinions differ 😄

0reactions
ssbarneacommented, Oct 12, 2020

Is not molecule goal to make decisions about this. Ansible-lint and yamllint are projects more suited to make decision in this area.

I personally am in favour of not using --- when is not needed, but I am in a position to impose my preference.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I remove the first line of a text file using bash/sed ...
If you want to remove the first line inside the file, you should use: ... The following command will delete the first line...
Read more >
Remove the First Line of a Text File in Linux - Baeldung
Removing the first line from an input file using the sed command is pretty straightforward. Let's see how to solve the problem with...
Read more >
remove first line in bash - Super User
Do you have a method to quickly remove the first line of a file in bash shell ? I mean using sed or...
Read more >
Commands on how to delete a first line from a text file using ...
In this short config we will show a multiple options on how to remove a first line from a text file. Here is...
Read more >
Delete First line of a file - shell script - Unix Stack Exchange
The first thing that happens with that line is the redirection. The file "file.txt" is opened and truncated to 0 bytes. After that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found