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 only
# reports failures instead of writing changes.
# 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
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 }, // typos:ignore-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:?}"
))]
// typos: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 })? // typos:ignore-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)
// typos: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.
// typos:ignore-block-start
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())
);
// typos:ignore-block-end
}

#[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 // typos:ignore-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"))] // typos:ignore-line
#[derive(
Clone,
Debug,
Expand Down
44 changes: 44 additions & 0 deletions typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Configuration for typos (https://github.com/crate-ci/typos), run via the prek
# hook in .pre-commit-config.yaml.

[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 = [
# Ignore `.git`, which the above `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.
# A marker must sit in a comment: after `#`, `//` or `;` (free text may follow),
# or inside a closed `<!-- -->`, `/* */` or `{# #}` (free text may precede the
# closer). An unterminated `typos:ignore-block-start` suppresses nothing.
#
# Use one of the following when the word is correct at one place but would still be a typo elsewhere:
#
# # typos:ignore-line at the end of the line it applies to
# # typos:ignore-next-line on its own line, above the offending line
# # typos:ignore-block-start / typos:ignore-block-end around a block
extend-ignore-re = [
'(?Rm)^.*?(?:(?:^|[^{])(?:#|//|;)[ \t]*typos:ignore-line\b.*|(?:<!--[ \t]*typos:ignore-line\b.*?-->|/\*[ \t]*typos:ignore-line\b.*?\*/|\{#[ \t]*typos:ignore-line\b.*?#\})[ \t]*)$',
'(?Rm)^[ \t]*(?:(?:#|//|;)[ \t]*typos:ignore-next-line\b.*|(?:<!--[ \t]*typos:ignore-next-line\b.*?-->|/\*[ \t]*typos:ignore-next-line\b.*?\*/|\{#[ \t]*typos:ignore-next-line\b.*?#\})[ \t]*)\r?\n.*$',
'(?ms)(?:(?:^|[^{])(?:#|//|;)[ \t]*typos:ignore-block-start\b|<!--[ \t]*typos:ignore-block-start\b[^\n]*?-->|/\*[ \t]*typos:ignore-block-start\b[^\n]*?\*/|\{#[ \t]*typos:ignore-block-start\b[^\n]*?#\}).*?(?:(?:^|[^{])(?:#|//|;)[ \t]*typos:ignore-block-end\b|<!--[ \t]*typos:ignore-block-end\b[^\n]*?-->|/\*[ \t]*typos:ignore-block-end\b[^\n]*?\*/|\{#[ \t]*typos:ignore-block-end\b[^\n]*?#\})',
]

# Before adding an entry in here, consider an in-place marker instead.
# Every entry below gets a one-line comment saying what the word is.
[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