Skip to content

Commit

Permalink
chore: rectify docs and centralise strum
Browse files Browse the repository at this point in the history
  • Loading branch information
benfdking committed Dec 1, 2024
1 parent a5c0d94 commit 8987dc1
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
- run: cargo r -F codegen-docs
- run: env GITHUB_ACTIONS=false cargo r -F codegen-docs
- uses: stefanzweifel/git-auto-commit-action@v5
with:
push_options: "--force"
Expand All @@ -22,5 +22,5 @@ jobs:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
- run: cargo r --bin sqruff -F codegen-docs
- run: env GITHUB_ACTIONS=false cargo r --bin sqruff -F codegen-docs
- run: git diff --quiet || exit 1
1 change: 1 addition & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ sqruff-lib-core = { version = "0.21.6", path = "crates/lib-core" }
sqruff-lib-dialects = { version = "0.21.6", path = "crates/lib-dialects"}
wasm-bindgen = "0.2"
wasm-pack = "0.13.0"

strum = "0.26.3"
strum_macros = "0.26.4"
1 change: 1 addition & 0 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ codegen-docs = ["clap-markdown", "minijinja", "serde", "python"]
[dependencies]
sqruff-lib.workspace = true
sqruff-lsp.workspace = true
strum_macros.workspace = true

clap = { version = "4", features = ["derive"] }
console = "0.15.8"
Expand Down
18 changes: 4 additions & 14 deletions crates/cli/src/commands.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::{
fmt::{write, Display},
path::PathBuf,
};
use std::path::PathBuf;
use strum_macros::Display;

use clap::{Parser, Subcommand, ValueEnum};

Expand Down Expand Up @@ -48,7 +46,8 @@ pub(crate) struct FixArgs {
pub format: Format,
}

#[derive(Debug, Clone, Copy, ValueEnum)]
#[derive(Debug, Clone, Copy, ValueEnum, Display)]
#[strum(serialize_all = "kebab-case")]
pub(crate) enum Format {
Human,
GithubAnnotationNative,
Expand All @@ -63,12 +62,3 @@ impl Default for Format {
}
}
}

impl Display for Format {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Format::Human => f.write_str("human"),
Format::GithubAnnotationNative => f.write_str("github-annotation-native"),
}
}
}
4 changes: 3 additions & 1 deletion crates/cli/src/github_action.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::env;

pub(crate) fn is_in_github_action() -> bool {
env::var("GITHUB_ACTIONS").is_ok()
env::var("GITHUB_ACTIONS")
.map(|s| s == "true")
.unwrap_or(false)
}
4 changes: 2 additions & 2 deletions crates/lib-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ stringify = ["dep:serde_yaml", "serde"]
[dependencies]
smol_str = "0.3.1"
ahash = { version = "0.8.11", features = ["compile-time-rng", "serde"] }
strum = "0.26.3"
strum.workspace = true
strum_macros.workspace = true
indexmap = "2.5.0"
strum_macros = "0.26.4"
nohash-hasher = "0.2.0"
itertools = "0.13.0"
fancy-regex = "0.14.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/lib-dialects/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ trino = []

[dependencies]
sqruff-lib-core.workspace = true
strum.workspace = true
itertools = "0.13.0"
ahash = "0.8.11"
strum = "0.26.3"
serde_yaml = "0.9.34+deprecated"

[dev-dependencies]
Expand Down

0 comments on commit 8987dc1

Please sign in to comment.