Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ default_language_version:
node: system

repos:
- repo: https://github.com/crate-ci/typos
rev: 00f422f3b19c57bc6338715ebfe3316d38768461 # v1.50.3
hooks:
- id: typos
# Drop the upstream default `--write-changes` so the hook reports and
# fails instead of rewriting files.
# Keep `--force-exclude` so the
# excludes in typos.toml still apply to the paths prek passes in.
args: ["--force-exclude"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # 5.0.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/config-utils/src/template/cli_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct TemplateCommand {
#[arg(value_enum)]
pub file_type: Option<FileType>,

/// By default inserted values are automatically escaped according to the deteced file format. You can disable
/// By default inserted values are automatically escaped according to the detected file format. You can disable
/// this, e.g. when you need to insert XML tags (as they otherwise would be escaped).
/// NOTE: Please make sure to correctly escape the inserted text on your own!
#[clap(long)]
Expand Down
8 changes: 5 additions & 3 deletions crates/config-utils/src/template/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub enum Error {
#[snafu(display(
"The extension {extension} is not known, can not determine file type. Please specify the file type manually."
))]
ExtensionUnkown { extension: String },
ExtensionUnkown { extension: String }, // spellchecker:disable-line

#[snafu(display("Failed to create temporary file {tmp_file_name:?}"))]
CreateTemporaryFile {
Expand Down Expand Up @@ -63,6 +63,7 @@ pub enum Error {
#[snafu(display(
"Could not find the end pattern {end_pattern:?} in expression {expression:?}"
))]
// spellchecker:ignore-next-line
FindEndPatten {
end_pattern: String,
expression: String,
Expand Down Expand Up @@ -95,7 +96,7 @@ pub fn template(file_name: &PathBuf, file_type: Option<&FileType>, escape: bool)

KNOWN_FILE_TYPES
.get(extension)
.context(ExtensionUnkownSnafu { extension })?
.context(ExtensionUnkownSnafu { extension })? // spellchecker:disable-line
}
};

Expand Down Expand Up @@ -198,7 +199,7 @@ fn replacement_action_for_env_var(env_var_name: &str) -> Result<String> {
/// * `replacement_action` must be a function that is called and get passed the [`&str`] content between the start and end
/// pattern. This can e.g. be the name of the env var or file name to read.
///
/// Returns wether the `line` was modified.
/// Returns whether the `line` was modified.
fn replace_thingy_in_line(
line: &mut String,
start_pattern: &str,
Expand All @@ -223,6 +224,7 @@ fn replace_thingy_in_line(
debug_assert_eq!(&line[index..index + start_pattern.len()], start_pattern);
let (parameter, _) = line[index + start_pattern.len()..]
.split_once(end_pattern)
// spellchecker:ignore-next-line
.context(FindEndPattenSnafu {
// FIXME: Truncate string to not bloat error message
expression: &line[index..],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub struct ResolvedProductImage {

/// Kubernetes' supported image pull policies.
///
/// Our product image selection choses the policy automatically based on two factors:
/// Our product image selection chooses the policy automatically based on two factors:
///
/// - If the image pull policy is explicitly set by the user
/// - If the used Stackable version is considered floating/the user opted for
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-operator/src/kvp/label/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ impl Labels {
///
/// This function returns a result, because the parameters `owner`, `app_name`,
/// and `role` can contain invalid data or can exceed the maximum allowed
/// number fo characters.
/// number of characters.
pub fn role_selector<R>(owner: &R, app_name: &str, role: &str) -> Result<Self, LabelError>
where
R: Resource,
Expand Down
2 changes: 2 additions & 0 deletions crates/stackable-operator/src/v2/env_overrides.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ mod tests {
#[test]
fn deserialize_rejects_invalid_names() {
// "=" is not allowed in environment variable names.
// spellchecker:off
let result: Result<EnvOverrides, serde_json::Error> = serde_json::from_value(json!({
"FO=O": "1"
}));
Expand All @@ -128,6 +129,7 @@ mod tests {
),
result.map_err(|err| err.to_string())
);
// spellchecker:on
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ mod tests {
}

#[test]
fn test_attributed_string_type_json_schema_without_constaints() {
fn test_attributed_string_type_json_schema_without_constraints() {
type T = JsonSchemaWithoutConstraintsTest;

T::test_example();
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-telemetry/src/tracing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ impl Tracing {
// NOTE (@NickLarsenNZ): There are various propagators. Eg: TraceContextPropagator
// standardises HTTP headers to propagate trace-id, parent-id, etc... while the
// BaggagePropagator sets a "baggage" header with the value being key=value pairs. There
// are other kinds too. There is also B3 and Jaeger, and some legacy stuff like OT Trace
// are other kinds too. There is also B3 and Jaeger, and some legacy stuff like OT Trace // spellchecker:disable-line
// and OpenCensus.
// See: https://opentelemetry.io/docs/specs/otel/context/api-propagators/
TraceContextPropagator::new(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use stackable_versioned::versioned;
#[versioned(version(name = "v1alpha1"))]
// ---
pub(crate) mod versioned {
#[versioned(crd(group = "stackable.tech", shortname = "f", shortname = "fo", doc = "Test"))]
#[versioned(crd(group = "stackable.tech", shortname = "f", shortname = "fo", doc = "Test"))] // spellchecker:disable-line
#[derive(
Clone,
Debug,
Expand Down
48 changes: 48 additions & 0 deletions typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Configuration for typos (https://github.com/crate-ci/typos), run via the prek
# hook in .pre-commit-config.yaml.
#
# Before adding an entry here, consider an in-place marker instead. Use one when
# the word is correct at this one site and would still be a typo elsewhere:
#
# # spellchecker:disable-line at the end of the line it applies to
# # spellchecker:ignore-next-line on its own line, above the offending line
# # spellchecker:off / :on around a block
#
# Every entry below gets a one-line comment saying what the word is.

[files]
# Bare `typos` skips hidden dirs by default, but prek passes explicit paths and
# so does check them. Turn it off so both agree.
ignore-hidden = false

extend-exclude = [
# `.git` itself, which ignore-hidden = false would otherwise pull in.
".git/",
# Generated by `cargo xtask crd preview`. Most of the content is Kubernetes'
# own schema documentation, which is not ours to correct, and the doc
# comments we do own are already checked at their source.
"crates/stackable-operator/crds/",
# Generated by `cargo insta`. The inputs they are rendered from are checked
# at their source in the sibling `inputs/` directories.
"crates/*/tests/snapshots/",
]

[default]
# typos has no native suppression directive
# (https://github.com/crate-ci/typos/issues/316), so these regexes provide one.
# They cover `#`, `//`, `<!-- -->`, `;`, `/* */` and Jinja `{# #}` comments,
# which spans every file type in this repo.
#
# Both failure modes are safe:
# * unterminated `:off` suppresses nothing rather than swallowing the rest of the file.
# * `disable-line` only matches when the marker ends the line.
extend-ignore-re = [
"(?Rm)^.*(#|//|<!--|;|/\\*)\\s*spellchecker:disable-line\\s*(-->|#\\}|\\*/)?\\s*$",
"(#|//|<!--|;|/\\*)\\s*spellchecker:ignore-next-line\\s*(-->|#\\}|\\*/)?\\s*\\n.*",
"(?s)(#|//|<!--|;|/\\*|\")\\s*spellchecker:off\\s*(-->|#\\}|\\*/|\")?.*?(#|//|<!--|;|/\\*|\")\\s*spellchecker:on\\s*(-->|#\\}|\\*/|\")?",
]

[default.extend-words]
# Accepted variant of "unparsable". Used in stackable-versioned test fixture file
# names (`unparseable_missing_field.json`), where an in-place marker cannot go.
unparseable = "unparseable"
Loading