Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9862d2b52a |
No files matched your search
@@ -165,7 +165,7 @@ style conventions are in separate documents:
|
|||||||
- `script/update-policy` itself, so the script stays current
|
- `script/update-policy` itself, so the script stays current
|
||||||
- `docs/CODE_STYLEGUIDE_GO.md`, when the repo has a `go.mod`
|
- `docs/CODE_STYLEGUIDE_GO.md`, when the repo has a `go.mod`
|
||||||
- `docs/GO_HTTP_SERVER_CONVENTIONS.md`, when its Go code imports `net/http`
|
- `docs/GO_HTTP_SERVER_CONVENTIONS.md`, when its Go code imports `net/http`
|
||||||
- `docs/CODE_STYLEGUIDE_JS.md`, when the repo tracks `.js` or `.ts` files
|
- `docs/CODE_STYLEGUIDE_JS.md`, when the repo has a `package.json`
|
||||||
- `docs/CODE_STYLEGUIDE_PYTHON.md`, when the repo has a `pyproject.toml` or
|
- `docs/CODE_STYLEGUIDE_PYTHON.md`, when the repo has a `pyproject.toml` or
|
||||||
`setup.py`
|
`setup.py`
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,8 @@ prompts/CODE_STYLEGUIDE.md:docs/CODE_STYLEGUIDE.md
|
|||||||
script/update-policy:script/update-policy
|
script/update-policy:script/update-policy
|
||||||
"
|
"
|
||||||
|
|
||||||
# The style guide for each language the repo uses, and the HTTP server
|
# The style guide for each language the repo uses, found by its file at
|
||||||
# conventions for Go code using net/http. Go and Python are found by
|
# the root, and the HTTP server conventions for Go code using net/http.
|
||||||
# their file at the root, JavaScript by tracked .js or .ts files: many
|
|
||||||
# Go repos have a package.json only to pin prettier.
|
|
||||||
language_files() {
|
language_files() {
|
||||||
if [ -e go.mod ]; then
|
if [ -e go.mod ]; then
|
||||||
echo prompts/CODE_STYLEGUIDE_GO.md:docs/CODE_STYLEGUIDE_GO.md
|
echo prompts/CODE_STYLEGUIDE_GO.md:docs/CODE_STYLEGUIDE_GO.md
|
||||||
@@ -26,7 +24,7 @@ language_files() {
|
|||||||
echo prompts/GO_HTTP_SERVER_CONVENTIONS.md:docs/GO_HTTP_SERVER_CONVENTIONS.md
|
echo prompts/GO_HTTP_SERVER_CONVENTIONS.md:docs/GO_HTTP_SERVER_CONVENTIONS.md
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -n "$(git ls-files -- '*.js' '*.ts')" ]; then
|
if [ -e package.json ]; then
|
||||||
echo prompts/CODE_STYLEGUIDE_JS.md:docs/CODE_STYLEGUIDE_JS.md
|
echo prompts/CODE_STYLEGUIDE_JS.md:docs/CODE_STYLEGUIDE_JS.md
|
||||||
fi
|
fi
|
||||||
if [ -e pyproject.toml ] || [ -e setup.py ]; then
|
if [ -e pyproject.toml ] || [ -e setup.py ]; then
|
||||||
|
|||||||
+2
-14
@@ -95,22 +95,10 @@ git commit -q -m go
|
|||||||
script/update-policy > "$dir/output" 2>&1 || fail "exited non-zero"
|
script/update-policy > "$dir/output" 2>&1 || fail "exited non-zero"
|
||||||
committed_files_are docs/CODE_STYLEGUIDE_GO.md
|
committed_files_are docs/CODE_STYLEGUIDE_GO.md
|
||||||
|
|
||||||
new_repo "a Go repo with a package.json only for prettier gets no JS guide"
|
new_repo "a repo with package.json and pyproject.toml gets the JS and Python guides"
|
||||||
echo "module example.com/app" > go.mod
|
|
||||||
printf 'package main\n\nimport "fmt"\n' > main.go
|
|
||||||
echo '{"devDependencies": {"prettier": "3.3.3"}}' > package.json
|
|
||||||
mkdir -p .yarn/releases
|
|
||||||
echo "// yarn" > .yarn/releases/yarn-4.5.0.cjs
|
|
||||||
git add go.mod main.go package.json .yarn/releases/yarn-4.5.0.cjs
|
|
||||||
git commit -q -m go-with-prettier
|
|
||||||
script/update-policy > "$dir/output" 2>&1 || fail "exited non-zero"
|
|
||||||
committed_files_are docs/CODE_STYLEGUIDE_GO.md
|
|
||||||
|
|
||||||
new_repo "a repo with .js files and pyproject.toml gets the JS and Python guides"
|
|
||||||
echo "{}" > package.json
|
echo "{}" > package.json
|
||||||
echo "console.log(1);" > index.js
|
|
||||||
echo "[project]" > pyproject.toml
|
echo "[project]" > pyproject.toml
|
||||||
git add package.json index.js pyproject.toml
|
git add package.json pyproject.toml
|
||||||
git commit -q -m js-and-python
|
git commit -q -m js-and-python
|
||||||
script/update-policy > "$dir/output" 2>&1 || fail "exited non-zero"
|
script/update-policy > "$dir/output" 2>&1 || fail "exited non-zero"
|
||||||
committed_files_are docs/CODE_STYLEGUIDE_JS.md docs/CODE_STYLEGUIDE_PYTHON.md
|
committed_files_are docs/CODE_STYLEGUIDE_JS.md docs/CODE_STYLEGUIDE_PYTHON.md
|
||||||
|
|||||||
Reference in new issue
Block a user