mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-19 01:50:38 +00:00
[ty] Merge ty_macros
into ruff_macros
(#19229)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks-instrumented (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks-instrumented (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
This commit is contained in:
parent
f32f7a3b48
commit
35a33f045e
8 changed files with 22 additions and 62 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -4189,15 +4189,6 @@ dependencies = [
|
|||
"ty_vendored",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ty_macros"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ty_project"
|
||||
version = "0.0.0"
|
||||
|
@ -4316,7 +4307,7 @@ dependencies = [
|
|||
name = "ty_static"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"ty_macros",
|
||||
"ruff_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
15
Cargo.toml
15
Cargo.toml
|
@ -41,7 +41,6 @@ ruff_workspace = { path = "crates/ruff_workspace" }
|
|||
|
||||
ty = { path = "crates/ty" }
|
||||
ty_ide = { path = "crates/ty_ide" }
|
||||
ty_macros = { path = "crates/ty_macros" }
|
||||
ty_project = { path = "crates/ty_project", default-features = false }
|
||||
ty_python_semantic = { path = "crates/ty_python_semantic" }
|
||||
ty_server = { path = "crates/ty_server" }
|
||||
|
@ -85,7 +84,7 @@ get-size2 = { version = "0.5.0", features = [
|
|||
"derive",
|
||||
"smallvec",
|
||||
"hashbrown",
|
||||
"compact-str"
|
||||
"compact-str",
|
||||
] }
|
||||
glob = { version = "0.3.1" }
|
||||
globset = { version = "0.4.14" }
|
||||
|
@ -175,7 +174,7 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
|
|||
"env-filter",
|
||||
"fmt",
|
||||
"ansi",
|
||||
"smallvec"
|
||||
"smallvec",
|
||||
] }
|
||||
tryfn = { version = "0.2.1" }
|
||||
typed-arena = { version = "2.0.2" }
|
||||
|
@ -185,11 +184,7 @@ unicode-width = { version = "0.2.0" }
|
|||
unicode_names2 = { version = "1.2.2" }
|
||||
unicode-normalization = { version = "0.1.23" }
|
||||
url = { version = "2.5.0" }
|
||||
uuid = { version = "1.6.1", features = [
|
||||
"v4",
|
||||
"fast-rng",
|
||||
"macro-diagnostics",
|
||||
] }
|
||||
uuid = { version = "1.6.1", features = ["v4", "fast-rng", "macro-diagnostics"] }
|
||||
walkdir = { version = "2.3.2" }
|
||||
wasm-bindgen = { version = "0.2.92" }
|
||||
wasm-bindgen-test = { version = "0.3.42" }
|
||||
|
@ -224,8 +219,8 @@ must_use_candidate = "allow"
|
|||
similar_names = "allow"
|
||||
single_match_else = "allow"
|
||||
too_many_lines = "allow"
|
||||
needless_continue = "allow" # An explicit continue can be more readable, especially if the alternative is an empty block.
|
||||
unnecessary_debug_formatting = "allow" # too many instances, the display also doesn't quote the path which is often desired in logs where we use them the most often.
|
||||
needless_continue = "allow" # An explicit continue can be more readable, especially if the alternative is an empty block.
|
||||
unnecessary_debug_formatting = "allow" # too many instances, the display also doesn't quote the path which is often desired in logs where we use them the most often.
|
||||
# Without the hashes we run into a `rustfmt` bug in some snapshot tests, see #13250
|
||||
needless_raw_string_hashes = "allow"
|
||||
# Disallowed restriction lints
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! This crate implements internal macros for the `ruff` library.
|
||||
//! This crate implements internal macros for the `ruff` and `ty` libraries.
|
||||
|
||||
use crate::cache_key::derive_cache_key;
|
||||
use crate::newtype_index::generate_newtype_index;
|
||||
|
@ -11,6 +11,7 @@ mod combine;
|
|||
mod combine_options;
|
||||
mod config;
|
||||
mod derive_message_formats;
|
||||
mod env_vars;
|
||||
mod kebab_case;
|
||||
mod map_codes;
|
||||
mod newtype_index;
|
||||
|
@ -144,3 +145,15 @@ pub fn newtype_index(_metadata: TokenStream, input: TokenStream) -> TokenStream
|
|||
|
||||
TokenStream::from(output)
|
||||
}
|
||||
|
||||
/// Generates metadata for environment variables declared in the impl block.
|
||||
///
|
||||
/// This attribute macro should be applied to an `impl EnvVars` block.
|
||||
/// It will generate a `metadata()` method that returns all non-hidden
|
||||
/// environment variables with their documentation.
|
||||
#[proc_macro_attribute]
|
||||
pub fn attribute_env_vars_metadata(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(item as syn::ItemImpl);
|
||||
|
||||
env_vars::attribute_env_vars_metadata(input).into()
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
[package]
|
||||
name = "ty_macros"
|
||||
version = "0.0.0"
|
||||
edition = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
homepage = { workspace = true }
|
||||
documentation = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = { workspace = true }
|
||||
quote = { workspace = true }
|
||||
syn = { workspace = true }
|
|
@ -1,18 +0,0 @@
|
|||
//! This crate implements internal macros for the `ty` library.
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use syn::parse_macro_input;
|
||||
|
||||
mod env_vars;
|
||||
|
||||
/// Generates metadata for environment variables declared in the impl block.
|
||||
///
|
||||
/// This attribute macro should be applied to an `impl EnvVars` block.
|
||||
/// It will generate a `metadata()` method that returns all non-hidden
|
||||
/// environment variables with their documentation.
|
||||
#[proc_macro_attribute]
|
||||
pub fn attribute_env_vars_metadata(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(item as syn::ItemImpl);
|
||||
|
||||
env_vars::attribute_env_vars_metadata(input).into()
|
||||
}
|
|
@ -16,4 +16,4 @@ doctest = false
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
ty_macros = { workspace = true }
|
||||
ruff_macros = { workspace = true }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ty_macros::attribute_env_vars_metadata;
|
||||
use ruff_macros::attribute_env_vars_metadata;
|
||||
|
||||
/// Declares all environment variable used throughout `ty` and its crates.
|
||||
pub struct EnvVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue