Skip to content

Commit

Permalink
[CI] Enforce no-trailing-spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Jan 31, 2025
1 parent 0d38602 commit 2998505
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 26 deletions.
7 changes: 4 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ root = true
[*]
end_of_line = lf
insert_final_newline = true

[Makefile]
indent_style = tab
trim_trailing_whitespace = true

[*.{html,js,json,md,sass,yaml}]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
5 changes: 4 additions & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"no-hard-tabs": false,
"no-inline-html": false,
"no-trailing-punctuation": false,
"no-trailing-spaces": true,
"no-trailing-spaces": {
"br_spaces": 0,
"strict": true
},
"custom-rules-below-this-point": false,
"trim-code-block-and-unindent": true
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
!/layouts/shortcodes/es
!/layouts/shortcodes/pt

/content/en/blog/2019
/content/en/blog/202[23]

/content/ja
/content/zh

Expand Down
10 changes: 5 additions & 5 deletions content/en/blog/2024/otel-governance/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ act as a liaison between those SIGs and the GC. Once a month, I ask SIG
maintainers from Collector, Operator, Security, and Go Autoinstrumentation
questions, such as:

1\. Do you have any specific issues within your SIG that would require GC
intervention?
2\. Are you happy with the current balance of
contributors/triagers/approvers/maintainers?
3\. What’s one thing the GC can help with to make your life easier?
1. Do you have any specific issues within your SIG that would require GC
intervention?
2. Are you happy with the current balance of
contributors/triagers/approvers/maintainers?
3. What’s one thing the GC can help with to make your life easier?

These responses are confidential, and maintainers know they can approach me with
any problems, like when there’s a conflict between community members. While I
Expand Down
27 changes: 17 additions & 10 deletions content/en/docs/contributing/style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,17 @@ properly.
## Markdown standards

To enforce standards and consistency for Markdown files, all files should follow
certain rules, enforced by
[markdownlint](https://github.com/DavidAnson/markdownlint). For a full list,
check the
[`.markdownlint.json`](https://github.com/open-telemetry/opentelemetry.io/blob/main/.markdownlint.json)
file.
certain rules, enforced by [markdownlint]. For a full list, check the
[.markdownlint.json] file.

Run:

Run `npm run check:markdown` to verify that all files follow the standard.
- `npm run check:markdown` to ensure that all files follow our standards
- `npm run fix:markdown` to fix Markdown-related formatting issues

Run `npm run fix:markdown` to fix Markdown related formatting issues.
We also enforce markdown [file format](#file-format) and strip files of trailing
whitespace. This precludes the [line break syntax] of 2+ spaces; use `<br>`
instead or reformat your text.

## Spell checking

Expand Down Expand Up @@ -107,12 +109,17 @@ run `npm run fix:dict`.

## File format

To enforce a certain standard on how files are structured, all files should be
formatted by [prettier](https://prettier.io). Run `npm run fix:format` before
submitting a PR, or run it afterwards and push an additional commit.
We enforce file formatting using [Prettier]. Invoke it using
`npm run fix:format`.

## File names

All file names should be in
[kebab case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case). Run
`npm run fix:filenames` to automatically rename your files.

[.markdownlint.json]:
https://github.com/open-telemetry/opentelemetry.io/blob/main/.markdownlint.json
[line break syntax]: https://www.markdownguide.org/basic-syntax/#line-breaks
[markdownlint]: https://github.com/DavidAnson/markdownlint
[Prettier]: https://prettier.io
2 changes: 1 addition & 1 deletion content/en/docs/kubernetes/operator/target-allocator.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
replacement: $$1
- action: labelmap
regex: label_(.+)
replacement: $$1
replacement: $$1
exporters:
# NOTE: Prior to v0.86.0 use `logging` instead of `debug`.
Expand Down
2 changes: 1 addition & 1 deletion content/es/docs/what-is-opentelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ puede extender incluyen:
- Cargar librerías de instrumentación personalizadas en un SDK.
- Crear una [distribución](/docs/concepts/distributions/) de un SDK o Collector
adaptada a un caso de uso específico.
- Crear un nuevo exportador para un backend personalizado que aún no admite el
- Crear un nuevo exportador para un backend personalizado que aún no admite el
protocolo OpenTelemetry (OTLP).
- Crear un propagador personalizado para un formato de propagación de contexto
que no es estándar.
Expand Down
2 changes: 1 addition & 1 deletion content/pt/docs/languages/js/getting-started/browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Copie o conteúdo a seguir em um arquivo em um diretório vazio e salve-o como
<base href="/" />
<!--
https://www.w3.org/TR/trace-context/
Defina o `traceparent` no código do template HTML do servidor. Ele
Defina o `traceparent` no código do template HTML do servidor. Ele
deve ser gerado dinamicamente pelo servidor para conter o ID do rastro
da requisição do servidor, um ID de trecho pai que foi definido no trecho
da requisição do servidor e as flags de rastro para indicar a decisão de
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"_diff:fail": "git diff --name-only --exit-code || exit 1",
"_fail": "exit 1",
"_filename-error": "echo 'ERROR: the following files violate naming conventions; fix using: `npm run fix:filenames`'; echo; npm run -s _ls-bad-filenames; exit 1",
"_fix:trailing-spaces": "find content -name '*.md' -exec perl -i -pe 's/[ \t]+$//g' {} +",
"_get:no": "echo SKIPPING get operation",
"_get:submodule": "set -x && git submodule update --init ${DEPTH:- --depth 999}",
"_hugo": "hugo --cleanDestinationDir",
Expand Down Expand Up @@ -68,15 +69,15 @@
"fix:dict": "find content layouts -name \"*.md\" -print0 | xargs -0 scripts/normalize-cspell-front-matter.pl",
"fix:expired": "npm run -s check:expired -- -q | xargs -r -I {} sh -c 'echo \"Deleting expired file: {}\" && rm {}'",
"fix:filenames": "npm run _rename-to-kebab-case",
"fix:format": "npm run format",
"fix:format": "npm run format; npm run _fix:trailing-spaces",
"fix:htmltest-config": "scripts/htmltest-config.sh",
"fix:i18n:all": "scripts/check-i18n.sh -a -c HEAD",
"fix:i18n:drifted": "scripts/check-i18n.sh -c HEAD",
"fix:i18n:new": "scripts/check-i18n.sh -n -c HEAD",
"fix:i18n": "npm run fix:i18n:new",
"fix:markdown": "npm run check:markdown -- --fix",
"fix:refcache": "npm run check:links",
"fix:markdown": "npm run check:markdown -- --fix; echo '\nTrimming trailing whitespace'; npm run _fix:trailing-spaces",
"fix:refcache:refresh": "npm run _refcache:prune -- -n ${PRUNE_N:-128}",
"fix:refcache": "npm run check:links",
"fix:submodule": "npm run pin:submodule",
"fix:text": "npm run check:text -- --fix",
"fix": "npm run fix:all",
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-markdown-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ for symlink_target in $symlink_targets; do
done

set -x
exec npm run _check:markdown "$@"
exec npm run _check:markdown -- "$@"

0 comments on commit 2998505

Please sign in to comment.