Skip to content
Merged
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
16 changes: 8 additions & 8 deletions Cargo.lock

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

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ members = ["crates/*"]
resolver = "2"

[workspace.package]
version = "2.25.1"
edition = "2024"
rust-version = "1.88.0"
authors = ["Squawk Team & Contributors"]
Expand Down Expand Up @@ -53,12 +54,12 @@ xshell = "0.2.7"
proc-macro2 = "1.0.95"

# local
squawk_github = { version = "0.0.0", path = "./crates/squawk_github" }
squawk_lexer = { version = "0.0.0", path = "./crates/squawk_lexer" }
squawk_parser = { version = "0.0.0", path = "./crates/squawk_parser" }
squawk_syntax = { version = "0.0.0", path = "./crates/squawk_syntax" }
squawk_linter = { version = "0.0.0", path = "./crates/squawk_linter" }
squawk_server = { version = "0.0.0", path = "./crates/squawk_server" }
squawk_github = { path = "./crates/squawk_github" }
squawk_lexer = { path = "./crates/squawk_lexer" }
squawk_parser = { path = "./crates/squawk_parser" }
squawk_syntax = { path = "./crates/squawk_syntax" }
squawk_linter = { path = "./crates/squawk_linter" }
squawk_server = { path = "./crates/squawk_server" }

[workspace.lints.clippy]
collapsible_else_if = "allow"
Expand Down
4 changes: 4 additions & 0 deletions PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ sql for benchmarks maybe?

https://github.com/pgvector/pgvector/blob/master/sql/vector.sql

- doomql

https://github.com/cedardb/DOOMQL

### CLI

from `deno`
Expand Down
2 changes: 1 addition & 1 deletion crates/squawk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "squawk"
version = "2.25.1"
version.workspace = true
default-run = "squawk"

authors.workspace = true
Expand Down
12 changes: 8 additions & 4 deletions crates/squawk/src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,10 @@ fn get_summary_comment_body(
file_summaries.push(summary);
}

let summary_notice = Some("⚠️ **Large Report**: This report was summarized due to size constraints. SQL content has been omitted but all violations were analyzed.");

let summary_notice = Some(
"⚠️ **Large Report**: This report was summarized due to size constraints. SQL content has been omitted but all violations were analyzed.",
);

format_comment(
violations_emoji,
violations_count,
Expand Down Expand Up @@ -293,8 +295,10 @@ fn truncate_sql_if_needed(sql: &str) -> (String, bool) {
if lines.len() <= MAX_SQL_PREVIEW_LINES {
(sql.to_string(), false)
} else {
let truncated_lines = lines[..MAX_SQL_PREVIEW_LINES].join("
");
let truncated_lines = lines[..MAX_SQL_PREVIEW_LINES].join(
"
",
);
let remaining_lines = lines.len() - MAX_SQL_PREVIEW_LINES;
(
format!(
Expand Down
2 changes: 1 addition & 1 deletion crates/squawk_github/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "squawk_github"
version = "0.0.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/squawk_lexer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "squawk_lexer"
version = "0.0.0"
version.workspace = true
description = "TBD"

authors.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/squawk_linter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "squawk_linter"
version = "0.0.0"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
Expand Down
1 change: 0 additions & 1 deletion crates/squawk_linter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ mod ignore_index;
mod version;
mod visitors;

mod identifier;
mod rules;

#[cfg(test)]
Expand Down
3 changes: 1 addition & 2 deletions crates/squawk_linter/src/rules/adding_field_with_default.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use lazy_static::lazy_static;
use std::collections::HashSet;

use squawk_syntax::ast;
use squawk_syntax::ast::AstNode;
use squawk_syntax::{Parse, SourceFile};
use squawk_syntax::{ast, identifier::Identifier};

use crate::identifier::Identifier;
use crate::{Linter, Rule, Version, Violation};

fn is_const_expr(expr: &ast::Expr) -> bool {
Expand Down
3 changes: 2 additions & 1 deletion crates/squawk_linter/src/rules/ban_char_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ use rowan::TextRange;
use squawk_syntax::{
Parse, SourceFile, TokenText,
ast::{self, AstNode},
identifier::Identifier,
};

use crate::visitors::check_not_allowed_types;
use crate::{Edit, Fix, Linter, Rule, Violation, identifier::Identifier};
use crate::{Edit, Fix, Linter, Rule, Violation};

use lazy_static::lazy_static;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ use std::collections::HashSet;
use squawk_syntax::{
Parse, SourceFile,
ast::{self, AstNode},
identifier::Identifier,
};

use crate::{Linter, Rule, Violation, identifier::Identifier};
use crate::{Linter, Rule, Violation};

pub fn tables_created_in_transaction(
assume_in_transaction: bool,
Expand Down
3 changes: 2 additions & 1 deletion crates/squawk_linter/src/rules/disallow_unique_constraint.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use squawk_syntax::{
Parse, SourceFile,
ast::{self, AstNode},
identifier::Identifier,
};

use crate::{Linter, Rule, Violation, identifier::Identifier};
use crate::{Linter, Rule, Violation};

use super::constraint_missing_not_valid::tables_created_in_transaction;

Expand Down
3 changes: 1 addition & 2 deletions crates/squawk_linter/src/rules/prefer_bigint_over_int.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::collections::HashSet;

use squawk_syntax::ast::AstNode;
use squawk_syntax::{Parse, SourceFile, ast};
use squawk_syntax::{Parse, SourceFile, ast, identifier::Identifier};

use crate::identifier::Identifier;
use crate::{Edit, Fix, Linter, Rule, Violation};

use crate::visitors::check_not_allowed_types;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::collections::HashSet;

use squawk_syntax::ast::AstNode;
use squawk_syntax::{Parse, SourceFile, ast};
use squawk_syntax::{Parse, SourceFile, ast, identifier::Identifier};

use crate::identifier::Identifier;
use crate::{Edit, Fix, Linter, Rule, Violation};

use crate::visitors::check_not_allowed_types;
Expand Down
3 changes: 2 additions & 1 deletion crates/squawk_linter/src/rules/prefer_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ use std::collections::HashSet;
use squawk_syntax::{
Parse, SourceFile,
ast::{self, AstNode},
identifier::Identifier,
};

use crate::{Edit, Fix, Linter, Rule, Violation, identifier::Identifier};
use crate::{Edit, Fix, Linter, Rule, Violation};

use lazy_static::lazy_static;

Expand Down
3 changes: 2 additions & 1 deletion crates/squawk_linter/src/rules/prefer_robust_stmts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ use std::collections::HashMap;
use squawk_syntax::{
Parse, SourceFile,
ast::{self, AstNode},
identifier::Identifier,
};

use crate::{Edit, Fix, Linter, Rule, Violation, identifier::Identifier};
use crate::{Edit, Fix, Linter, Rule, Violation};

#[derive(PartialEq)]
enum Constraint {
Expand Down
3 changes: 2 additions & 1 deletion crates/squawk_linter/src/rules/prefer_text_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ use std::collections::HashSet;
use squawk_syntax::{
Parse, SourceFile,
ast::{self, AstNode},
identifier::Identifier,
};

use crate::{Edit, Fix, Linter, Rule, Violation, identifier::Identifier};
use crate::{Edit, Fix, Linter, Rule, Violation};

use crate::visitors::check_not_allowed_types;

Expand Down
3 changes: 2 additions & 1 deletion crates/squawk_linter/src/rules/prefer_timestamptz.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use squawk_syntax::{
Parse, SourceFile,
ast::{self, AstNode},
identifier::Identifier,
};

use crate::visitors::check_not_allowed_types;
use crate::{Edit, Fix, Linter, Rule, Violation};
use crate::{identifier::Identifier, visitors::check_not_allowed_types};

pub fn is_not_allowed_timestamp(ty: &ast::Type) -> bool {
match ty {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use squawk_syntax::{
Parse, SourceFile,
ast::{self, AstNode},
identifier::Identifier,
};

use crate::{Edit, Fix, Linter, Rule, Violation, identifier::Identifier};
use crate::{Edit, Fix, Linter, Rule, Violation};

use super::constraint_missing_not_valid::tables_created_in_transaction;

Expand Down
4 changes: 2 additions & 2 deletions crates/squawk_linter/src/visitors.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::collections::HashSet;

use squawk_syntax::ast;
use squawk_syntax::{ast, identifier::Identifier};

use crate::{Linter, identifier::Identifier};
use crate::Linter;

pub(crate) fn is_not_valid_int_type(
ty: &ast::Type,
Expand Down
2 changes: 1 addition & 1 deletion crates/squawk_parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "squawk_parser"
version = "0.0.0"
version.workspace = true
description = "TBD"

authors.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/squawk_server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "squawk_server"
version = "0.0.0"
version.workspace = true

authors.workspace = true
edition.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/squawk_syntax/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "squawk_syntax"
version = "0.0.0"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
///
/// This type handles the casing rules for us to make comparisions easier.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub(crate) struct Identifier(String);
pub struct Identifier(String);

impl Identifier {
// TODO: we need to handle more advanced identifiers like:
Expand Down
1 change: 1 addition & 0 deletions crates/squawk_syntax/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
// DEALINGS IN THE SOFTWARE.

pub mod ast;
pub mod identifier;
mod parsing;
pub mod syntax_error;
mod syntax_node;
Expand Down
2 changes: 1 addition & 1 deletion crates/squawk_wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "squawk_wasm"
version = "0.1.0"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/xtask/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xtask"
version = "0.1.0"
version.workspace = true

authors.workspace = true
edition.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion s/check-version
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CLI_VERSION_PATTERN = r"version = \"(?P<version>\d+\.\d+\.\d+)\""


def find_cli_version() -> str:
cargo_toml = squawk_root() / "crates/squawk/Cargo.toml"
cargo_toml = squawk_root() / "Cargo.toml"
for line in cargo_toml.read_text().split("\n"):
match = re.match(CLI_VERSION_PATTERN, line)
if match is not None:
Expand Down
Loading
Loading