Coder Social home page Coder Social logo

dprint-plugin-dockerfile's Introduction

dprint

CI Homebrew

Monorepo for dprint—a pluggable and configurable code formatting platform.

Links

Plugins

Notes

This repo is under active early development.

  1. The interface between the CLI and plugins might change often. You may need to keep updating to the latest version of both the CLI and plugins (the CLI will let you know what to do).
    • An upgrade path will be outlined in the release notes when this occurs.
  2. I do a lot of this development in my spare time. Please consider sponsoring if you are a commercial company using this.

dprint-plugin-dockerfile's People

Contributors

dcecile avatar dsherret avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dcecile

dprint-plugin-dockerfile's Issues

`dprint init`'s `includes` does not follow common Dockerfile name

Describe the bug

Dockerfiles are usually named Dockerfile, most tools will work with a file named as such by default, not .dockerfile

dprint-plugin-dockerfile version: 0.3.0

Input Code

dprint init (select at least dprint-plugin-dockerfile)

Expected Output

  "includes": ["**/Dockerfile"],

Actual Output

  "includes": ["**/.{dockerfile}"],

[Bug] Parse error caused by FROM instruction with digest

Describe the bug
When the expression FROM <image>@digest is included, a parse error occurs.
It also gives an error when I use FROM <image>:tag@digest.

dprint-plugin-dockerfile version: 0.3.0

Input Code

FROM ghcr.io/jqlang/jq@sha256:12f998e5a6f3f6916f744ba6f01549f156f624b42f7564e67ec6dd4733973146 as fetch-jq

Expected Output

FROM ghcr.io/jqlang/jq@sha256:12f998e5a6f3f6916f744ba6f01549f156f624b42f7564e67ec6dd4733973146 AS fetch-jq

Actual Output

$ dprint check Dockerfile
Error formatting /home/mogyuchi/prj/fixup-twitter-link/Dockerfile. Message: could not parse Dockerfile:  --> 1:23
  |
1 | FROM ghcr.io/jqlang/jq@sha256:12f998e5a6f3f6916f744ba6f01549f156f624b42f7564e67ec6dd4733973146 as fetch-jq␊
  |                       ^---
  |
  = expected EOI
Had 1 error(s) formatting.

RuntimeError occurs when processing empty comment line

Describe the bug

dprint-plugin-dockerfile version: 0.2.2

Input Code

#

Expected Output

#

Actual Output

The following error message is output:

Critical error formatting /path/to/Dockerfile. Cannot continue. Message: Originally panicked in dprint-plugin-dockerfile, then failed reinitialize. This may be a bug in the plugin, the dprint cli is out of date, or the plugin is out of date.
Original error: RuntimeError: unreachable
Reinitialize error: RuntimeError: unreachable
Had 1 error(s) formatting.

Doesn't work with `Dockerfile.*`

When there's a need to have multiple Dockerfiles in a single directory, it's relatively common to name them Dockerfile.*, e.g. Dockerfile.dev, Dockerfile.prod.

I've tried configuring dprint to match such files, but it doesn't seem to work:

{
  "dockerfile": {},
  "includes": [
    "**/Dockerfile",
    "**/Dockerfile.*"
  ],
  "excludes": [],
  "plugins": [
    "https://plugins.dprint.dev/dockerfile-0.3.0.wasm"
  ]
}

If I have Dockerfile and Dockerfile.prod at the root of my project, running dprint output-file-paths finds Dockerfile but not Dockerfile.prod. It doesn't even work if I explicitly add **/Dockerfile.prod to includes.

If I add **/*.Dockerfile to includes and mv Dockerfile.prod prod.Dockerfile, it does find the file, but this isn't our preferred naming convention.

dprint-plugin-dockerfile version: 0.3.0

Returns `UnexpectedEOF` if the dockerfile uses JSON array syntax for the `COPY` command

Describe the bug

dprint-plugin-dockerfile version: 0.3.0
dprint version: 0.37.1

Input Code

FROM ubuntu:jammy-20230605

COPY  ["a.txt", "./"]

Expected Output

FROM ubuntu:jammy-20230605

COPY ["a.txt", "./"]

Actual Output

> dprint check
Error formatting /home/kachick/repos/dprint-plugin-dockerfile-copy-syntax-array/Dockerfile. Message: error unescaping string: UnexpectedEOF
Had 1 error(s) formatting.

Duplicate double quotes when quoting commands with double quotes in `RUN`

I noticed this issue because when I use variables in the path of a command, I sometimes enclose the command in double quotes.

Describe the bug

dprint-plugin-dockerfile version: 0.2.3

Input Code

FROM ubuntu:22.04

RUN "ls"

RUN "ls" -l

Expected Output

FROM ubuntu:22.04

RUN "ls"

RUN "ls" -l

Actual Output

dprint check:

from /path/to/Dockerfile:
1 1| FROM·ubuntu:22.04
2 2|
  3|-RUN·"ls"
3  |+RUN·""ls""
4 4|
  5|-RUN·"ls"·-l
5  |+RUN·""ls"·-l"
--
Found 1 not formatted file.

dprint fmt:

Error formatting /path/to/Dockerfile. Message: Formatting not stable. Bailed after 5 tries. This indicates a bug in the plugin where it formats the file differently each time.
Had 1 error(s) formatting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.