From afdb1f76e8717f753e12d5720f4fe8ac4b71c312 Mon Sep 17 00:00:00 2001 From: Tpt Date: Mon, 6 Feb 2023 17:43:08 +0100 Subject: [PATCH] Adds a typo linter as part of the CI --- .github/workflows/tests.yml | 8 ++++++++ CHANGELOG.md | 4 ++-- lib/spargebra/src/parser.rs | 6 +++--- lib/src/sparql/plan_builder.rs | 2 +- server/src/main.rs | 2 +- testsuite/oxigraph-tests/sparql/manifest.ttl | 8 ++++---- typos.toml | 2 ++ 7 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 typos.toml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index efa88714..279e66e4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -227,6 +227,14 @@ jobs: - run: python -m unittest working-directory: ./python/tests + typos: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: Swatinem/rust-cache@v2 + - run: cargo install typos-cli || true + - run: typos + fuzz_changes: if: github.event_name == 'pull_request' runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 5242b2b6..1f8f4c6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,7 +51,7 @@ - SPARQL: fixes serialization of SPARQL queries (property path and STRSTARTS function). - SPARQL: slightly optimize aggregates by avoiding an unneeded projection. - SPARQL: the parser now cleanly fails if invalid `VALUES` clauses are provided. -- SPARQL: In DELETE/INSERT UPDATEs the currently written values can't be read anymore ("Halloween problem"). +- SPARQL: In DELETE/INSERT UPDATE the currently written values can't be read anymore ("Halloween problem"). - `oxrdf`: makes Clippy run without warnings when `rdf-star` is disable. - Python: makes type annotations compatible with Python 3.7. - Python: makes sure the parameter default value is always included in the type annotation. @@ -215,7 +215,7 @@ - Server: The HTTP response bodies are now generated on the fly instead of being buffered. - Python: The `SledStore` and `MemoryStore` classes have been removed in favor of the `Store` class. - JS: The `MemoryStore` class has been renamed to `Store`. -- JS: The [RDF/JS `DataFactory` interface](http://rdf.js.org/data-model-spec/#datafactory-interface) is now implemented by the `oxigraph` module itself and the `MemoryStore.dataFactory` propery has been removed. +- JS: The [RDF/JS `DataFactory` interface](http://rdf.js.org/data-model-spec/#datafactory-interface) is now implemented by the `oxigraph` module itself and the `MemoryStore.dataFactory` property has been removed. - The implementation of SPARQL evaluation has been improved for better performances (especially joins). - The TLS implementation used in SPARQL HTTP calls is now [rustls](https://github.com/rustls/rustls) and not [native-tls](https://github.com/sfackler/rust-native-tls). The host system certificate registry is still used. - Spargebra: The basic RDF terms are now the ones of the `oxrdf` crate. diff --git a/lib/spargebra/src/parser.rs b/lib/spargebra/src/parser.rs index 1d4358c9..689b95ce 100644 --- a/lib/spargebra/src/parser.rs +++ b/lib/spargebra/src/parser.rs @@ -442,7 +442,7 @@ impl Selection { fn build_select( select: Selection, - wher: GraphPattern, + r#where: GraphPattern, mut group: Option<(Vec, Vec<(Expression, Variable)>)>, having: Option, order_by: Option>, @@ -450,7 +450,7 @@ fn build_select( values: Option, state: &mut ParserState, ) -> Result { - let mut p = wher; + let mut p = r#where; let mut with_aggregate = false; //GROUP BY @@ -1429,7 +1429,7 @@ parser! { } }); if contains { - return Err("An existing variable is overriden in the right side of LATERAL"); + return Err("An existing variable is overridden in the right side of LATERAL"); } g = GraphPattern::Lateral { left: Box::new(g), right: Box::new(p) } } diff --git a/lib/src/sparql/plan_builder.rs b/lib/src/sparql/plan_builder.rs index 61cbba58..f2c1dc57 100644 --- a/lib/src/sparql/plan_builder.rs +++ b/lib/src/sparql/plan_builder.rs @@ -144,7 +144,7 @@ impl<'a> PlanBuilder<'a> { Box::new(self.build_for_expression(expr, variables, graph_name)?), ), GraphPattern::Union { left, right } => { - //We flatten the UNIONs + //We flatten the UNION let mut stack: Vec<&GraphPattern> = vec![left, right]; let mut children = vec![]; loop { diff --git a/server/src/main.rs b/server/src/main.rs index fd84b5ec..79e9e71f 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -1505,7 +1505,7 @@ mod tests { // PUT - mismatched payload let request = Request::builder(Method::PUT, "http://localhost/store/person/1.ttl".parse()?) .with_header(HeaderName::CONTENT_TYPE, "text/turtle; charset=utf-8")? - .with_body("@prefix fo"); + .with_body("@prefix foo"); server.test_status(request, Status::BAD_REQUEST)?; // PUT - empty graph diff --git a/testsuite/oxigraph-tests/sparql/manifest.ttl b/testsuite/oxigraph-tests/sparql/manifest.ttl index 48deb671..d1ae7178 100644 --- a/testsuite/oxigraph-tests/sparql/manifest.ttl +++ b/testsuite/oxigraph-tests/sparql/manifest.ttl @@ -35,19 +35,19 @@ ) . :small_unicode_escape_with_multibytes_char rdf:type mf:NegativeSyntaxTest ; - mf:name "Multibytes character at the end of a unicode espace sequence" ; + mf:name "Multibytes character at the end of a unicode escape sequence" ; mf:action . :long_unicode_escape_with_multibytes_char rdf:type mf:NegativeSyntaxTest ; - mf:name "Multibytes character at the end of a unicode espace sequence" ; + mf:name "Multibytes character at the end of a unicode escape sequence" ; mf:action . :small_unicode_escape_with_multibytes_char_update rdf:type mf:NegativeUpdateSyntaxTest11 ; - mf:name "Multibytes character at the end of a unicode espace sequence" ; + mf:name "Multibytes character at the end of a unicode escape sequence" ; mf:action . :long_unicode_escape_with_multibytes_char_update rdf:type mf:NegativeUpdateSyntaxTest11 ; - mf:name "Multibytes character at the end of a unicode espace sequence" ; + mf:name "Multibytes character at the end of a unicode escape sequence" ; mf:action . :describe rdf:type mf:QueryEvaluationTest ; diff --git a/typos.toml b/typos.toml new file mode 100644 index 00000000..266310d5 --- /dev/null +++ b/typos.toml @@ -0,0 +1,2 @@ +[files] +extend-exclude = ["**/*.svg"]