xtask: Add typos check
This commit is contained in:
parent
40f0e88cb6
commit
e2375ed72e
9
.github/workflows/nightly.yml
vendored
9
.github/workflows/nightly.yml
vendored
@ -33,3 +33,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
command: run
|
command: run
|
||||||
args: -p xtask --no-default-features ci nightly
|
args: -p xtask --no-default-features ci nightly
|
||||||
|
|
||||||
|
typos:
|
||||||
|
name: Spell Check with Typos
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Check the spelling of the files in our repo
|
||||||
|
uses: crate-ci/typos@master
|
||||||
|
5
.typos.toml
Normal file
5
.typos.toml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[default.extend-words]
|
||||||
|
# Remove this once base64 gets correctly ignored by typos
|
||||||
|
# Or if we're able to ignore certain lines.
|
||||||
|
NAX = "NAX"
|
||||||
|
Nd = "Nd"
|
@ -37,7 +37,7 @@ impl From<Relation> for ReactionEventContent {
|
|||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[serde(tag = "rel_type", rename = "m.annotation")]
|
#[serde(tag = "rel_type", rename = "m.annotation")]
|
||||||
pub struct Relation {
|
pub struct Relation {
|
||||||
/// The event that is being annoted.
|
/// The event that is being annotated.
|
||||||
pub event_id: Box<EventId>,
|
pub event_id: Box<EventId>,
|
||||||
|
|
||||||
/// A string that indicates the annotation being applied.
|
/// A string that indicates the annotation being applied.
|
||||||
|
@ -456,7 +456,7 @@ mod tests {
|
|||||||
assert!("foobar".matches_pattern("foo*", false));
|
assert!("foobar".matches_pattern("foo*", false));
|
||||||
assert!("foo bar".matches_pattern("foo*", false));
|
assert!("foo bar".matches_pattern("foo*", false));
|
||||||
assert!(!"foo".matches_pattern("foo?", false));
|
assert!(!"foo".matches_pattern("foo?", false));
|
||||||
assert!("foo".matches_pattern("fo?", false));
|
assert!("fooo".matches_pattern("foo?", false));
|
||||||
assert!("FOO".matches_pattern("foo", false));
|
assert!("FOO".matches_pattern("foo", false));
|
||||||
assert!("".matches_pattern("", false));
|
assert!("".matches_pattern("", false));
|
||||||
assert!("".matches_pattern("*", false));
|
assert!("".matches_pattern("*", false));
|
||||||
|
@ -31,8 +31,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Serde serializiation decorator to map None to an empty String,
|
/// Serde serializiation decorator to map `None` to an empty `String`,
|
||||||
/// and forward Somes to the Serialize implementation for T.
|
/// and forward `Some`s to the `Serialize` implementation for `T`.
|
||||||
///
|
///
|
||||||
/// To be used like this:
|
/// To be used like this:
|
||||||
/// `#[serde(serialize_with = "empty_string_as_none")]`
|
/// `#[serde(serialize_with = "empty_string_as_none")]`
|
||||||
|
@ -68,7 +68,7 @@ fn empty_post_response_http_repr() {
|
|||||||
let res = post::Response {};
|
let res = post::Response {};
|
||||||
let http_res = res.try_into_http_response::<Vec<u8>>().unwrap();
|
let http_res = res.try_into_http_response::<Vec<u8>>().unwrap();
|
||||||
|
|
||||||
// For the reponse, the body should be an empty dict again...
|
// For the response, the body should be an empty dict again...
|
||||||
assert_eq!(http_res.body(), b"{}");
|
assert_eq!(http_res.body(), b"{}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ Breaking changes:
|
|||||||
|
|
||||||
Breaking changes:
|
Breaking changes:
|
||||||
|
|
||||||
* Fix a typo in a public function name: `user_id::localpart_is_fully_{comforming => conforming}`
|
* Fix a typo in a public function name: `user_id::localpart_is_fully_conforming`
|
||||||
|
|
||||||
# 0.3.0
|
# 0.3.0
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ pub enum CiCmd {
|
|||||||
Dependencies,
|
Dependencies,
|
||||||
/// Check spec links point to a recent version (nightly)
|
/// Check spec links point to a recent version (nightly)
|
||||||
SpecLinks,
|
SpecLinks,
|
||||||
|
/// Check typos
|
||||||
|
Typos,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Task to run CI tests.
|
/// Task to run CI tests.
|
||||||
@ -70,6 +72,7 @@ impl CiTask {
|
|||||||
Some(CiCmd::Clippy) => self.clippy()?,
|
Some(CiCmd::Clippy) => self.clippy()?,
|
||||||
Some(CiCmd::Dependencies) => self.dependencies()?,
|
Some(CiCmd::Dependencies) => self.dependencies()?,
|
||||||
Some(CiCmd::SpecLinks) => check_spec_links(&self.project_root.join("crates"))?,
|
Some(CiCmd::SpecLinks) => check_spec_links(&self.project_root.join("crates"))?,
|
||||||
|
Some(CiCmd::Typos) => self.typos()?,
|
||||||
None => {
|
None => {
|
||||||
self.build_msrv().and(self.build_stable()).and(self.build_nightly())?;
|
self.build_msrv().and(self.build_stable()).and(self.build_nightly())?;
|
||||||
}
|
}
|
||||||
@ -136,14 +139,9 @@ impl CiTask {
|
|||||||
// Check dependencies being sorted
|
// Check dependencies being sorted
|
||||||
let dependencies_res = self.dependencies();
|
let dependencies_res = self.dependencies();
|
||||||
// Check that all links point to the same version of the spec
|
// Check that all links point to the same version of the spec
|
||||||
let spec_links = check_spec_links(&self.project_root.join("crates"));
|
let spec_links_res = check_spec_links(&self.project_root.join("crates"));
|
||||||
|
|
||||||
fmt_res
|
fmt_res.and(check_full_res).and(clippy_res).and(dependencies_res).and(spec_links_res)
|
||||||
.and(check_full_res)
|
|
||||||
.and(clippy_res)
|
|
||||||
.and(dependencies_res)
|
|
||||||
.map_err(Into::into)
|
|
||||||
.and(spec_links)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check the formatting with the nightly version.
|
/// Check the formatting with the nightly version.
|
||||||
@ -189,4 +187,14 @@ impl CiTask {
|
|||||||
.run()
|
.run()
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check the typos.
|
||||||
|
fn typos(&self) -> Result<()> {
|
||||||
|
if cmd!("typos --version").run().is_err() {
|
||||||
|
return Err(
|
||||||
|
"Could not find typos. Install it by running `cargo install typos-cli`".into()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
cmd!("typos").run().map_err(Into::into)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user