From cdbfe4190cebf5c49a99d7b914c07ed56e914a21 Mon Sep 17 00:00:00 2001 From: Markus Hofbauer Date: Wed, 31 Jul 2024 16:09:17 +0200 Subject: [PATCH] fix(typos): Fix almost all typos with hook (#884) * Fix almost all typos with hook * align docs --- .aspect/bazelrc/convenience.bazelrc | 2 +- .gitattributes | 2 +- .pre-commit-config.yaml | 4 ++-- .typos.toml | 2 ++ docs/docs.md | 2 +- docs/expand_template.md | 2 +- docs/glob_match.md | 4 ++-- docs/lists.md | 2 +- docs/params_file.md | 2 +- docs/strings.md | 4 ++-- docs/utils.md | 12 ++++++------ docs/yq.md | 2 +- lib/params_file.bzl | 4 ++-- lib/private/docs.bzl | 2 +- lib/private/expand_template.bzl | 2 +- lib/private/glob_match.bzl | 8 ++++---- lib/private/lists.bzl | 2 +- lib/private/strings.bzl | 4 ++-- lib/private/utils.bzl | 6 +++--- lib/tar.bzl | 2 +- lib/tests/bazelrc_presets/all/convenience.bazelrc | 2 +- lib/tests/bazelrc_presets/all/correctness.bazelrc | 2 +- lib/tests/bazelrc_presets/subset/convenience.bazelrc | 2 +- lib/windows_utils.bzl | 2 +- lib/yq.bzl | 2 +- 25 files changed, 41 insertions(+), 39 deletions(-) create mode 100644 .typos.toml diff --git a/.aspect/bazelrc/convenience.bazelrc b/.aspect/bazelrc/convenience.bazelrc index c674569..796675a 100644 --- a/.aspect/bazelrc/convenience.bazelrc +++ b/.aspect/bazelrc/convenience.bazelrc @@ -3,7 +3,7 @@ build --keep_going # Output test errors to stderr so users don't have to `cat` or open test failure log files when test -# fail. This makes the log noiser in exchange for reducing the time-to-feedback on test failures for +# fail. This makes the log noisier in exchange for reducing the time-to-feedback on test failures for # users. # Docs: https://bazel.build/docs/user-manual#test-output test --test_output=errors diff --git a/.gitattributes b/.gitattributes index 8491cd9..70d5043 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,7 +9,7 @@ docs/*.md linguist-generated=true lib/tests export-ignore # Omit the .bazeliskrc file for the smoke test that runs on the Bazel Central -# Regsitry ci because we test on Windows but do not publish Aspect CLI Windows +# Registry ci because we test on Windows but do not publish Aspect CLI Windows # binaries. e2e/smoke/.bazeliskrc export-ignore diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1eb5696..55ce95b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,8 +42,8 @@ repos: - id: typos exclude: | (?x)^( - docs/| - lib/ + lib/private/yq_toolchain.bzl| + lib/tests/glob_match_test.bzl ) - repo: local hooks: diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..b14a952 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,2 @@ +[default.extend-identifiers] +MODULEs = "MODULEs" # Else it becomes MODULEEs diff --git a/docs/docs.md b/docs/docs.md index 64ca998..3f23352 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -12,7 +12,7 @@ stardoc_with_diff_test(name, is_executable | Whether to mark the output file as executable. | Boolean | optional | False | | out | Where to write the expanded file.

If the template is a source file, then out defaults to be named the same as the template file and outputted to the same workspace-relative path. In this case there will be no pre-declared label for the output file. It can be referenced by the target label instead. This pattern is similar to copy_to_bin but with substitutions on the copy.

Otherwise, out defaults to [name].txt. | Label | optional | | | stamp | Whether to encode build information into the output. Possible values:

- stamp = 1: Always stamp the build information into the output, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it is non-deterministic. It potentially causes remote cache misses for the target and any downstream actions that depend on the result. - stamp = 0: Never stamp, instead replace build information by constant values. This gives good build result caching. - stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag. Stamped targets are not rebuilt unless their dependencies change. | Integer | optional | -1 | -| stamp_substitutions | Mapping of strings to substitutions.

There are overlayed on top of substitutions when stamping is enabled for the target.

Substitutions can contain $(execpath :target) and $(rootpath :target) expansions, $(MAKEVAR) expansions and {{STAMP_VAR}} expansions when stamping is enabled for the target. | Dictionary: String -> String | optional | {} | +| stamp_substitutions | Mapping of strings to substitutions.

There are overlaid on top of substitutions when stamping is enabled for the target.

Substitutions can contain $(execpath :target) and $(rootpath :target) expansions, $(MAKEVAR) expansions and {{STAMP_VAR}} expansions when stamping is enabled for the target. | Dictionary: String -> String | optional | {} | | substitutions | Mapping of strings to substitutions.

Substitutions can contain $(execpath :target) and $(rootpath :target) expansions, $(MAKEVAR) expansions and {{STAMP_VAR}} expansions when stamping is enabled for the target. | Dictionary: String -> String | optional | {} | | template | The template file to expand. | Label | required | | diff --git a/docs/glob_match.md b/docs/glob_match.md index ec6e5fe..7874ba1 100644 --- a/docs/glob_match.md +++ b/docs/glob_match.md @@ -41,7 +41,7 @@ True if the path matches the glob expression is_glob(expr) -Determine if the passed string is a globa expression +Determine if the passed string is a global expression **PARAMETERS** @@ -52,6 +52,6 @@ Determine if the passed string is a globa expression **RETURNS** -True if the passed string is a globa expression +True if the passed string is a global expression diff --git a/docs/lists.md b/docs/lists.md index 03143fc..79e5960 100644 --- a/docs/lists.md +++ b/docs/lists.md @@ -67,7 +67,7 @@ find(f, arr) Find a particular item from list `arr` by a given function `f`. Unlike `pick`, the `find` method returns a tuple of the index and the value of first item passing by `f`. -Furhermore `find` does not fail if no item passes `f`. +Furthermore `find` does not fail if no item passes `f`. In this case `(-1, None)` is returned. diff --git a/docs/params_file.md b/docs/params_file.md index 281ba43..5cbba2f 100644 --- a/docs/params_file.md +++ b/docs/params_file.md @@ -25,7 +25,7 @@ Handles variable substitutions for args. | :------------- | :------------- | :------------- | | name | Name of the rule. | none | | out | Path of the output file, relative to this package. | none | -| args | Arguments to concatenate into a params file.

- Subject to 'Make variable' substitution. See https://docs.bazel.build/versions/main/be/make-variables.html.

- Subject to predefined source/output path variables substitutions.

The predefined variables execpath, execpaths, rootpath, rootpaths, location, and locations take label parameters (e.g. $(execpath //foo:bar)) and substitute the file paths denoted by that label.

See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_label_variables for more info.

NB: This $(location) substition returns the manifest file path which differs from the *_binary & *_test args and genrule bazel substitions. This will be fixed in a future major release. See docs string of expand_location_into_runfiles macro in internal/common/expand_into_runfiles.bzl for more info.

- Subject to predefined variables & custom variable substitutions.

Predefined "Make" variables such as $(COMPILATION_MODE) and $(TARGET_CPU) are expanded. See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_variables.

Custom variables are also expanded including variables set through the Bazel CLI with --define=SOME_VAR=SOME_VALUE. See https://docs.bazel.build/versions/main/be/make-variables.html#custom_variables.

Predefined genrule variables are not supported in this context. | [] | +| args | Arguments to concatenate into a params file.

- Subject to 'Make variable' substitution. See https://docs.bazel.build/versions/main/be/make-variables.html.

- Subject to predefined source/output path variables substitutions.

The predefined variables execpath, execpaths, rootpath, rootpaths, location, and locations take label parameters (e.g. $(execpath //foo:bar)) and substitute the file paths denoted by that label.

See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_label_variables for more info.

NB: This $(location) substitution returns the manifest file path which differs from the *_binary & *_test args and genrule bazel substitutions. This will be fixed in a future major release. See docs string of expand_location_into_runfiles macro in internal/common/expand_into_runfiles.bzl for more info.

- Subject to predefined variables & custom variable substitutions.

Predefined "Make" variables such as $(COMPILATION_MODE) and $(TARGET_CPU) are expanded. See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_variables.

Custom variables are also expanded including variables set through the Bazel CLI with --define=SOME_VAR=SOME_VALUE. See https://docs.bazel.build/versions/main/be/make-variables.html#custom_variables.

Predefined genrule variables are not supported in this context. | [] | | data | Data for $(location) expansions in args. | [] | | newline | Line endings to use. One of ["auto", "unix", "windows"].

- "auto" for platform-determined - "unix" for LF - "windows" for CRLF | "auto" | | kwargs | undocumented named arguments | none | diff --git a/docs/strings.md b/docs/strings.md index bbab788..08daf4a 100644 --- a/docs/strings.md +++ b/docs/strings.md @@ -36,7 +36,7 @@ unicode string of the position hex(number) -Format integer to hexdecimal representation +Format integer to hexadecimal representation **PARAMETERS** @@ -47,7 +47,7 @@ Format integer to hexdecimal representation **RETURNS** -hexdecimal representation of the number argument +hexadecimal representation of the number argument diff --git a/docs/utils.md b/docs/utils.md index 82f21e9..c9e63bb 100644 --- a/docs/utils.md +++ b/docs/utils.md @@ -303,7 +303,7 @@ Path to the workspace root propagate_common_binary_rule_attributes(attrs) -Returns a dict of rule parameters filtered from the input dict that only contains the onces that are common to all binary rules +Returns a dict of rule parameters filtered from the input dict that only contains the ones that are common to all binary rules These are listed in Bazel's documentation: https://bazel.build/reference/be/common-definitions#common-attributes @@ -330,7 +330,7 @@ The dict of parameters, containing only common binary attributes propagate_common_rule_attributes(attrs) -Returns a dict of rule parameters filtered from the input dict that only contains the onces that are common to all rules +Returns a dict of rule parameters filtered from the input dict that only contains the ones that are common to all rules These are listed in Bazel's documentation: https://bazel.build/reference/be/common-definitions#common-attributes @@ -356,7 +356,7 @@ The dict of parameters, containing only common attributes propagate_common_test_rule_attributes(attrs) -Returns a dict of rule parameters filtered from the input dict that only contains the onces that are common to all test rules +Returns a dict of rule parameters filtered from the input dict that only contains the ones that are common to all test rules These are listed in Bazel's documentation: https://bazel.build/reference/be/common-definitions#common-attributes @@ -720,7 +720,7 @@ List of tags that only contains the well known set utils.propagate_common_rule_attributes(attrs) -Returns a dict of rule parameters filtered from the input dict that only contains the onces that are common to all rules +Returns a dict of rule parameters filtered from the input dict that only contains the ones that are common to all rules These are listed in Bazel's documentation: https://bazel.build/reference/be/common-definitions#common-attributes @@ -746,7 +746,7 @@ The dict of parameters, containing only common attributes utils.propagate_common_test_rule_attributes(attrs) -Returns a dict of rule parameters filtered from the input dict that only contains the onces that are common to all test rules +Returns a dict of rule parameters filtered from the input dict that only contains the ones that are common to all test rules These are listed in Bazel's documentation: https://bazel.build/reference/be/common-definitions#common-attributes @@ -773,7 +773,7 @@ The dict of parameters, containing only common test attributes utils.propagate_common_binary_rule_attributes(attrs) -Returns a dict of rule parameters filtered from the input dict that only contains the onces that are common to all binary rules +Returns a dict of rule parameters filtered from the input dict that only contains the ones that are common to all binary rules These are listed in Bazel's documentation: https://bazel.build/reference/be/common-definitions#common-attributes diff --git a/docs/yq.md b/docs/yq.md index e39caa2..9a3ee6d 100644 --- a/docs/yq.md +++ b/docs/yq.md @@ -113,7 +113,7 @@ yq is capable of parsing and outputting to other formats. See their [docs](https | srcs | List of input file labels | none | | expression | yq expression (https://mikefarah.gitbook.io/yq/commands/evaluate). Defaults to the identity expression ".". Subject to stamp variable replacements, see [Stamping](./stamping.md). When stamping is enabled, an environment variable named "STAMP" will be available in the expression.

Be careful to write the filter so that it handles unstamped builds, as in the example above. | "." | | args | Additional args to pass to yq. Note that you do not need to pass _eval_ or _eval-all_ as this is handled automatically based on the number srcs. Passing the output format or the parse format is optional as these can be guessed based on the file extensions in srcs and outs. | [] | -| outs | Name of the output files. Defaults to a single output with the name plus a ".yaml" extension, or the extension corresponding to a passed output argment (e.g., "-o=json"). For split operations you must declare all outputs as the name of the output files depends on the expression. | None | +| outs | Name of the output files. Defaults to a single output with the name plus a ".yaml" extension, or the extension corresponding to a passed output argument (e.g., "-o=json"). For split operations you must declare all outputs as the name of the output files depends on the expression. | None | | kwargs | Other common named parameters such as tags or visibility | none | diff --git a/lib/params_file.bzl b/lib/params_file.bzl index 87fd233..c72ad99 100644 --- a/lib/params_file.bzl +++ b/lib/params_file.bzl @@ -27,8 +27,8 @@ def params_file( See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_label_variables for more info. - NB: This $(location) substition returns the manifest file path which differs from the `*_binary` & `*_test` - args and genrule bazel substitions. This will be fixed in a future major release. + NB: This $(location) substitution returns the manifest file path which differs from the `*_binary` & `*_test` + args and genrule bazel substitutions. This will be fixed in a future major release. See docs string of `expand_location_into_runfiles` macro in `internal/common/expand_into_runfiles.bzl` for more info. diff --git a/lib/private/docs.bzl b/lib/private/docs.bzl index efa225d..feeb852 100644 --- a/lib/private/docs.bzl +++ b/lib/private/docs.bzl @@ -9,7 +9,7 @@ def stardoc_with_diff_test( **kwargs): """Creates a stardoc target that can be auto-detected by update_docs to write the generated doc to the source tree and test that it's up to date. - This is helpful for minimizing boilerplate in repos wih lots of stardoc targets. + This is helpful for minimizing boilerplate in repos with lots of stardoc targets. Args: name: the name of the stardoc file to be written to the current source directory (.md will be appended to the name). Call bazel run on this target to update the file. diff --git a/lib/private/expand_template.bzl b/lib/private/expand_template.bzl index 64167b0..f913e8c 100644 --- a/lib/private/expand_template.bzl +++ b/lib/private/expand_template.bzl @@ -104,7 +104,7 @@ such as `$(BINDIR)`, `$(TARGET_CPU)`, and `$(COMPILATION_MODE)` as documented in "stamp_substitutions": attr.string_dict( doc = """Mapping of strings to substitutions. - There are overlayed on top of substitutions when stamping is enabled + There are overlaid on top of substitutions when stamping is enabled for the target. Substitutions can contain $(execpath :target) and $(rootpath :target) diff --git a/lib/private/glob_match.bzl b/lib/private/glob_match.bzl index 330a2b4..b0548be 100644 --- a/lib/private/glob_match.bzl +++ b/lib/private/glob_match.bzl @@ -17,20 +17,20 @@ def _validate_glob(expr): for i in range(expr_len): if expr[i] == "*" and i < expr_len - 1 and expr[i + 1] == "*": if i > 0 and expr[i - 1] != "/": - msg = "glob_match: `**` globstar in expression `{}` must be at the start of the expression or preceeded by `/`".format(expr) + msg = "glob_match: `**` globstar in expression `{}` must be at the start of the expression or preceded by `/`".format(expr) fail(msg) if i < expr_len - 2 and expr[i + 2] != "/": msg = "glob_match: `**` globstar in expression `{}` must be at the end of the expression or followed by `/`".format(expr) fail(msg) def is_glob(expr): - """Determine if the passed string is a globa expression + """Determine if the passed string is a global expression Args: expr: the potential glob expression Returns: - True if the passed string is a globa expression + True if the passed string is a global expression """ return expr.find("*") != -1 or expr.find("?") != -1 @@ -169,7 +169,7 @@ def glob_match(expr, path, match_path_separator = False): super_continue = True break - # Succesfully consumed a path segment + # Successfully consumed a path segment if super_continue: continue diff --git a/lib/private/lists.bzl b/lib/private/lists.bzl index df52268..cc2624d 100644 --- a/lib/private/lists.bzl +++ b/lib/private/lists.bzl @@ -38,7 +38,7 @@ def find(f, arr): """Find a particular item from list `arr` by a given function `f`. Unlike `pick`, the `find` method returns a tuple of the index and the value of first item passing by `f`. - Furhermore `find` does not fail if no item passes `f`. + Furthermore `find` does not fail if no item passes `f`. In this case `(-1, None)` is returned. Args: diff --git a/lib/private/strings.bzl b/lib/private/strings.bzl index 91e6215..c0fe541 100644 --- a/lib/private/strings.bzl +++ b/lib/private/strings.bzl @@ -559,13 +559,13 @@ def _to_char(n): return alpha[n] def hex(number): - """Format integer to hexdecimal representation + """Format integer to hexadecimal representation Args: number: number to format Returns: - hexdecimal representation of the number argument + hexadecimal representation of the number argument """ hex_string = "" diff --git a/lib/private/utils.bzl b/lib/private/utils.bzl index 229ad8d..b26bc5c 100644 --- a/lib/private/utils.bzl +++ b/lib/private/utils.bzl @@ -312,7 +312,7 @@ _COMMON_BINARY_RULE_ATTRIBUTES = _COMMON_RULE_ATTRIBUTES + [ ] def _propagate_common_rule_attributes(attrs): - """Returns a dict of rule parameters filtered from the input dict that only contains the onces that are common to all rules + """Returns a dict of rule parameters filtered from the input dict that only contains the ones that are common to all rules These are listed in Bazel's documentation: https://bazel.build/reference/be/common-definitions#common-attributes @@ -331,7 +331,7 @@ def _propagate_common_rule_attributes(attrs): } def _propagate_common_test_rule_attributes(attrs): - """Returns a dict of rule parameters filtered from the input dict that only contains the onces that are common to all test rules + """Returns a dict of rule parameters filtered from the input dict that only contains the ones that are common to all test rules These are listed in Bazel's documentation: https://bazel.build/reference/be/common-definitions#common-attributes @@ -351,7 +351,7 @@ def _propagate_common_test_rule_attributes(attrs): } def _propagate_common_binary_rule_attributes(attrs): - """Returns a dict of rule parameters filtered from the input dict that only contains the onces that are common to all binary rules + """Returns a dict of rule parameters filtered from the input dict that only contains the ones that are common to all binary rules These are listed in Bazel's documentation: https://bazel.build/reference/be/common-definitions#common-attributes diff --git a/lib/tar.bzl b/lib/tar.bzl index ad8e508..12060f0 100644 --- a/lib/tar.bzl +++ b/lib/tar.bzl @@ -110,7 +110,7 @@ def tar(name, mtree = "auto", stamp = 0, **kwargs): # Ensure there's a trailing newline, as bsdtar will ignore a last line without one template = ["#mtree", "{content}", ""], substitutions = { - # expand_template only expands strings in "substitions" dict. Here + # expand_template only expands strings in "substitutions" dict. Here # we expand mtree and then replace the template with expanded mtree. "{content}": "\n".join(mtree), }, diff --git a/lib/tests/bazelrc_presets/all/convenience.bazelrc b/lib/tests/bazelrc_presets/all/convenience.bazelrc index c674569..796675a 100644 --- a/lib/tests/bazelrc_presets/all/convenience.bazelrc +++ b/lib/tests/bazelrc_presets/all/convenience.bazelrc @@ -3,7 +3,7 @@ build --keep_going # Output test errors to stderr so users don't have to `cat` or open test failure log files when test -# fail. This makes the log noiser in exchange for reducing the time-to-feedback on test failures for +# fail. This makes the log noisier in exchange for reducing the time-to-feedback on test failures for # users. # Docs: https://bazel.build/docs/user-manual#test-output test --test_output=errors diff --git a/lib/tests/bazelrc_presets/all/correctness.bazelrc b/lib/tests/bazelrc_presets/all/correctness.bazelrc index a599f6d..f381062 100644 --- a/lib/tests/bazelrc_presets/all/correctness.bazelrc +++ b/lib/tests/bazelrc_presets/all/correctness.bazelrc @@ -68,7 +68,7 @@ build --incompatible_default_to_explicit_init_py common --incompatible_disallow_empty_glob # Always download coverage files for tests from the remote cache. By default, coverage files are not -# downloaded on test result cahce hits when --remote_download_minimal is enabled, making it impossible +# downloaded on test result cache hits when --remote_download_minimal is enabled, making it impossible # to generate a full coverage report. # Docs: https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs # detching remote cache results diff --git a/lib/tests/bazelrc_presets/subset/convenience.bazelrc b/lib/tests/bazelrc_presets/subset/convenience.bazelrc index c674569..796675a 100644 --- a/lib/tests/bazelrc_presets/subset/convenience.bazelrc +++ b/lib/tests/bazelrc_presets/subset/convenience.bazelrc @@ -3,7 +3,7 @@ build --keep_going # Output test errors to stderr so users don't have to `cat` or open test failure log files when test -# fail. This makes the log noiser in exchange for reducing the time-to-feedback on test failures for +# fail. This makes the log noisier in exchange for reducing the time-to-feedback on test failures for # users. # Docs: https://bazel.build/docs/user-manual#test-output test --test_output=errors diff --git a/lib/windows_utils.bzl b/lib/windows_utils.bzl index f08f2d7..4801fde 100644 --- a/lib/windows_utils.bzl +++ b/lib/windows_utils.bzl @@ -94,7 +94,7 @@ call :rlocation "{sh_script}" run_script for %%a in ("{bash_bin}") do set "bash_bin_dir=%%~dpa" set PATH=%bash_bin_dir%;%PATH% set args=%* -rem Escape \ and * in args before passsing it with double quote +rem Escape \ and * in args before passing it with double quote if defined args ( set args=!args:\=\\\\! set args=!args:"=\"! diff --git a/lib/yq.bzl b/lib/yq.bzl index 6449126..653470e 100644 --- a/lib/yq.bzl +++ b/lib/yq.bzl @@ -115,7 +115,7 @@ def yq(name, srcs, expression = ".", args = [], outs = None, **kwargs): is handled automatically based on the number `srcs`. Passing the output format or the parse format is optional as these can be guessed based on the file extensions in `srcs` and `outs`. outs: Name of the output files. Defaults to a single output with the name plus a ".yaml" extension, or - the extension corresponding to a passed output argment (e.g., "-o=json"). For split operations you + the extension corresponding to a passed output argument (e.g., "-o=json"). For split operations you must declare all outputs as the name of the output files depends on the expression. **kwargs: Other common named parameters such as `tags` or `visibility` """