jumanjihouse / pre-commit-hook-yamlfmt

YAML formatter for http://pre-commit.com
MIT License
61 stars 28 forks source link

Is it possible to ignore a line ? #45

Open nitrogene opened 1 year ago

nitrogene commented 1 year ago

Hello,

I am working on a docker compose including mongo (among other services), and I have an issue with yamlfmt. Let's look at the following example:

  mongo:
    image: $MONGO_IMAGE:$MONGO_VERSION
    container_name: mongo
    hostname: mongo
    volumes:
      # Persistent docker volume
      - mongo-storage:/data/db:rw
    networks:
      - logging_network
    restart: 'no'

Yamlfmt turns it into:

  mongo:
    image: $MONGO_IMAGE:$MONGO_VERSION
    container_name: mongo
    hostname: mongo
    volumes:
      # Persistent docker volume
      - mongo-storage:/data/db:rw
    networks:
      - logging_network
    restart: no

Please notice that the single quotes around no are removed. But they are required. Is it possible to make yamlfmt ignore this line ?

Corfucinas commented 1 year ago

I also want to know this, I have a script to insert a licence and its removing it from the top of the file before '----'