-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
linter: lint rule for using the legacy key/value format with whitespace #4923
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,4 +105,11 @@ var ( | |
return fmt.Sprintf("Multiple %s instructions should not be used in the same stage because only the last one will be used", instructionName) | ||
}, | ||
} | ||
RuleLegacyKeyValueFormat = LinterRule[func(cmdName string) string]{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should provide some hint that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed this message to read differently so now it explicitly mentions the solution in the detailed description. |
||
Name: "LegacyKeyValueFormat", | ||
Description: "Legacy key/value format with whitespace separator should not be used", | ||
Format: func(cmdName string) string { | ||
return fmt.Sprintf("\"%s key=value\" should be used instead of legacy \"%s key value\" format", cmdName, cmdName) | ||
}, | ||
} | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
(from "brimstone/ubuntu:14.04") | ||
(label "maintainer" "brimstone@the.narro.ws") | ||
(env "GOPATH" "/go") | ||
(label "maintainer" "brimstone@the.narro.ws" "") | ||
(env "GOPATH" "/go" "") | ||
(entrypoint "/usr/local/bin/consuldock") | ||
(run "apt-get update \t&& dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.clean && apt-get --no-install-recommends install -y git golang ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists \t&& go get -v github.com/brimstone/consuldock && mv $GOPATH/bin/consuldock /usr/local/bin/consuldock \t&& dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.dirty \t&& apt-get remove --purge -y $(diff /tmp/dpkg.clean /tmp/dpkg.dirty | awk '/^>/ {print $2}') \t&& rm /tmp/dpkg.* \t&& rm -rf $GOPATH") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
(from "ubuntu") | ||
(env "name" "value") | ||
(env "name" "value") | ||
(env "name" "value" "name2" "value2") | ||
(env "name" "\"value value1\"") | ||
(env "name" "value\\ value2") | ||
(env "name" "\"value'quote space'value2\"") | ||
(env "name" "'value\"double quote\"value2'") | ||
(env "name" "value\\ value2" "name2" "value2\\ value3") | ||
(env "name" "\"a\\\"b\"") | ||
(env "name" "\"a\\'b\"") | ||
(env "name" "'a\\'b'") | ||
(env "name" "'a\\'b''") | ||
(env "name" "'a\\\"b'") | ||
(env "name" "\"''\"") | ||
(env "name" "value" "name1" "value1" "name2" "\"value2a value2b\"" "name3" "\"value3a\\n\\\"value3b\\\"\"" "name4" "\"value4a\\\\nvalue4b\"") | ||
(env "name" "value" "") | ||
(env "name" "value" "=") | ||
(env "name" "value" "=" "name2" "value2" "=") | ||
(env "name" "\"value value1\"" "=") | ||
(env "name" "value\\ value2" "=") | ||
(env "name" "\"value'quote space'value2\"" "=") | ||
(env "name" "'value\"double quote\"value2'" "=") | ||
(env "name" "value\\ value2" "=" "name2" "value2\\ value3" "=") | ||
(env "name" "\"a\\\"b\"" "=") | ||
(env "name" "\"a\\'b\"" "=") | ||
(env "name" "'a\\'b'" "=") | ||
(env "name" "'a\\'b''" "=") | ||
(env "name" "'a\\\"b'" "=") | ||
(env "name" "\"''\"" "=") | ||
(env "name" "value" "=" "name1" "value1" "=" "name2" "\"value2a value2b\"" "=" "name3" "\"value3a\\n\\\"value3b\\\"\"" "=" "name4" "\"value4a\\\\nvalue4b\"" "=") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(from "image") | ||
(label "maintainer" "foo@bar.com") | ||
(env "GOPATH" "\\go") | ||
(label "maintainer" "foo@bar.com" "") | ||
(env "GOPATH" "\\go" "") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(from "image") | ||
(label "maintainer" "foo@bar.com") | ||
(env "GOPATH" "\\go") | ||
(label "maintainer" "foo@bar.com" "") | ||
(env "GOPATH" "\\go" "") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(from "image") | ||
(label "maintainer" "foo@bar.com") | ||
(env "GOPATH" "\\go") | ||
(label "maintainer" "foo@bar.com" "") | ||
(env "GOPATH" "\\go" "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know there were some concerns about warning about these being potentially too strict.
Wondering if we should have a "more permissive" and "more strict" rule. The most problematic ones are when multiple whitespaces are present;
Those look very much alike, but
ARG
means 3 args are defined, but theENV
one defines a singlekey
env with valueone two