Skip to content

Commit

Permalink
Add spell checking (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvdb authored Jan 15, 2024
1 parent 4ea231b commit c92ae21
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
sudo cat /etc/postgresql/14/main/pg_hba.conf
sudo service postgresql restart && sleep 3
echo BUTANE_PG_CONNSTR="host=localhost user=postgres sslmode=disable port=5432" >> $GITHUB_ENV
- name: Install Rust tools
run: cargo install typos-cli
- name: Build
run: make build
- name: Lint
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ lint :
$(CARGO) clippy --all-features -- -D warnings


check : build test doclint lint
check : build test doclint lint spellcheck


test :
Expand All @@ -25,6 +25,9 @@ clean :
$(CARGO) clean


spellcheck :
typos

doclint :
RUSTDOCFLAGS="-D warnings" $(CARGO_NIGHTLY) doc --no-deps --all-features

Expand Down
2 changes: 1 addition & 1 deletion butane_core/src/codegen/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn many_table(main_table_name: &str, many_field: &Field, pk_field: &Field) -> AT
.expect("fields must be named")
.to_string();
let many_field_type = get_many_sql_type(many_field)
.unwrap_or_else(|| panic!("Mis-identified Many field {field_name}"));
.unwrap_or_else(|| panic!("Misidentified Many field {field_name}"));
let pk_field_name = pk_field
.ident
.as_ref()
Expand Down
2 changes: 1 addition & 1 deletion butane_core/src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ fn is_row_field(f: &Field) -> bool {
}

/// Test if the ident of each segment in two paths is the same without
/// looking at the argments
/// looking at the arguments.
fn is_same_path_ident(path1: &syn::Path, path2: &syn::Path) -> bool {
if path1.segments.len() != path2.segments.len() {
return false;
Expand Down
10 changes: 5 additions & 5 deletions butane_core/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ fn make_litstr_from_str() {

#[test]
fn test_get_deferred_sql_type() {
// primative type
// primitive type
let type_path: syn::TypePath = syn::parse_quote!(i8);
let typ = syn::Type::Path(type_path);
let rv = get_deferred_sql_type(&typ);
if let DeferredSqlType::KnownId(TypeIdentifier::Ty(sql_tye)) = rv {
assert_eq!(sql_tye, SqlType::Int);
if let DeferredSqlType::KnownId(TypeIdentifier::Ty(sql_type)) = rv {
assert_eq!(sql_type, SqlType::Int);
} else {
panic!()
}

let type_path: syn::TypePath = syn::parse_quote!(Option<i8>);
let typ = syn::Type::Path(type_path);
let rv = get_deferred_sql_type(&typ);
if let DeferredSqlType::KnownId(TypeIdentifier::Ty(sql_tye)) = rv {
assert_eq!(sql_tye, SqlType::Int);
if let DeferredSqlType::KnownId(TypeIdentifier::Ty(sql_type)) = rv {
assert_eq!(sql_type, SqlType::Int);
} else {
panic!()
}
Expand Down

0 comments on commit c92ae21

Please sign in to comment.