mirror of https://github.com/astral-sh/ruff
Merge a965c98f51 into b0bc990cbf
This commit is contained in:
commit
b5de799dcc
|
|
@ -1707,15 +1707,6 @@ dependencies = [
|
||||||
"rustversion",
|
"rustversion",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "is-docker"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3"
|
|
||||||
dependencies = [
|
|
||||||
"once_cell",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is-macro"
|
name = "is-macro"
|
||||||
version = "0.3.7"
|
version = "0.3.7"
|
||||||
|
|
@ -1739,16 +1730,6 @@ dependencies = [
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "is-wsl"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5"
|
|
||||||
dependencies = [
|
|
||||||
"is-docker",
|
|
||||||
"once_cell",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is_terminal_polyfill"
|
name = "is_terminal_polyfill"
|
||||||
version = "1.70.1"
|
version = "1.70.1"
|
||||||
|
|
@ -3181,7 +3162,6 @@ dependencies = [
|
||||||
"imperative",
|
"imperative",
|
||||||
"insta",
|
"insta",
|
||||||
"is-macro",
|
"is-macro",
|
||||||
"is-wsl",
|
|
||||||
"itertools 0.14.0",
|
"itertools 0.14.0",
|
||||||
"jiff",
|
"jiff",
|
||||||
"libcst",
|
"libcst",
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,6 @@ indoc = { version = "2.0.4" }
|
||||||
insta = { version = "1.35.1" }
|
insta = { version = "1.35.1" }
|
||||||
insta-cmd = { version = "0.6.0" }
|
insta-cmd = { version = "0.6.0" }
|
||||||
is-macro = { version = "0.3.5" }
|
is-macro = { version = "0.3.5" }
|
||||||
is-wsl = { version = "0.4.0" }
|
|
||||||
itertools = { version = "0.14.0" }
|
itertools = { version = "0.14.0" }
|
||||||
jiff = { version = "0.2.0" }
|
jiff = { version = "0.2.0" }
|
||||||
js-sys = { version = "0.3.69" }
|
js-sys = { version = "0.3.69" }
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ globset = { workspace = true }
|
||||||
hashbrown = { workspace = true }
|
hashbrown = { workspace = true }
|
||||||
imperative = { workspace = true }
|
imperative = { workspace = true }
|
||||||
is-macro = { workspace = true }
|
is-macro = { workspace = true }
|
||||||
is-wsl = { workspace = true }
|
|
||||||
itertools = { workspace = true }
|
itertools = { workspace = true }
|
||||||
libcst = { workspace = true }
|
libcst = { workspace = true }
|
||||||
jiff = { workspace = true }
|
jiff = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,11 @@ use crate::rules::flake8_executable::helpers::is_executable;
|
||||||
///
|
///
|
||||||
/// A file is considered executable if it has the executable bit set (i.e., its
|
/// A file is considered executable if it has the executable bit set (i.e., its
|
||||||
/// permissions mode intersects with `0o111`). As such, _this rule is only
|
/// permissions mode intersects with `0o111`). As such, _this rule is only
|
||||||
/// available on Unix-like systems_, and is not enforced on Windows or WSL.
|
/// available on Unix-like systems_.
|
||||||
|
///
|
||||||
|
/// If this rule produces a significant amount of false positives, it's likely
|
||||||
|
/// your source is stored on a filesystem that does not implement Unix file
|
||||||
|
/// permissions (e.g. FAT variants, NTFS, CIFS network mounts, VM/WSL shared folders, etc).
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: Executable Python Scripts](https://docs.python.org/3/tutorial/appendix.html#executable-python-scripts)
|
/// - [Python documentation: Executable Python Scripts](https://docs.python.org/3/tutorial/appendix.html#executable-python-scripts)
|
||||||
|
|
@ -47,12 +51,6 @@ impl Violation for ShebangMissingExecutableFile {
|
||||||
/// EXE002
|
/// EXE002
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
pub(crate) fn shebang_missing_executable_file(filepath: &Path, context: &LintContext) {
|
pub(crate) fn shebang_missing_executable_file(filepath: &Path, context: &LintContext) {
|
||||||
// WSL supports Windows file systems, which do not have executable bits.
|
|
||||||
// Instead, everything is executable. Therefore, we skip this rule on WSL.
|
|
||||||
|
|
||||||
if is_wsl::is_wsl() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if let Ok(true) = is_executable(filepath) {
|
if let Ok(true) = is_executable(filepath) {
|
||||||
context.report_diagnostic_if_enabled(
|
context.report_diagnostic_if_enabled(
|
||||||
ShebangMissingExecutableFile,
|
ShebangMissingExecutableFile,
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,11 @@ use crate::rules::flake8_executable::helpers::is_executable;
|
||||||
///
|
///
|
||||||
/// A file is considered executable if it has the executable bit set (i.e., its
|
/// A file is considered executable if it has the executable bit set (i.e., its
|
||||||
/// permissions mode intersects with `0o111`). As such, _this rule is only
|
/// permissions mode intersects with `0o111`). As such, _this rule is only
|
||||||
/// available on Unix-like systems_, and is not enforced on Windows or WSL.
|
/// available on Unix-like systems_.
|
||||||
|
///
|
||||||
|
/// If this rule produces a significant amount of false positives, it's likely
|
||||||
|
/// your source is stored on a filesystem that does not implement Unix file
|
||||||
|
/// permissions (e.g. FAT variants, NTFS, CIFS network mounts, VM/WSL shared folders, etc).
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```python
|
/// ```python
|
||||||
|
|
@ -51,13 +55,6 @@ impl Violation for ShebangNotExecutable {
|
||||||
/// EXE001
|
/// EXE001
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
pub(crate) fn shebang_not_executable(filepath: &Path, range: TextRange, context: &LintContext) {
|
pub(crate) fn shebang_not_executable(filepath: &Path, range: TextRange, context: &LintContext) {
|
||||||
// WSL supports Windows file systems, which do not have executable bits.
|
|
||||||
// Instead, everything is executable. Therefore, we skip this rule on WSL.
|
|
||||||
|
|
||||||
if is_wsl::is_wsl() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Ok(false) = is_executable(filepath) {
|
if let Ok(false) = is_executable(filepath) {
|
||||||
context.report_diagnostic_if_enabled(ShebangNotExecutable, range);
|
context.report_diagnostic_if_enabled(ShebangNotExecutable, range);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue