Drop WSL1 special case in flake8-executable

WSL1 is very very dead, and WSL2 handles permissions properly.
Fixes `cargo test` on Ruff itself failing on WSL2, and removes
what's generally a high potential footgun.
This commit is contained in:
K900 2025-12-01 14:27:42 +03:00
parent c2773b4c6f
commit a965c98f51
5 changed files with 10 additions and 37 deletions

20
Cargo.lock generated
View File

@ -1670,15 +1670,6 @@ dependencies = [
"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]]
name = "is-macro"
version = "0.3.7"
@ -1702,16 +1693,6 @@ dependencies = [
"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]]
name = "is_terminal_polyfill"
version = "1.70.1"
@ -3131,7 +3112,6 @@ dependencies = [
"imperative",
"insta",
"is-macro",
"is-wsl",
"itertools 0.14.0",
"jiff",
"libcst",

View File

@ -112,7 +112,6 @@ indoc = { version = "2.0.4" }
insta = { version = "1.35.1" }
insta-cmd = { version = "0.6.0" }
is-macro = { version = "0.3.5" }
is-wsl = { version = "0.4.0" }
itertools = { version = "0.14.0" }
jiff = { version = "0.2.0" }
js-sys = { version = "0.3.69" }

View File

@ -41,7 +41,6 @@ globset = { workspace = true }
hashbrown = { workspace = true }
imperative = { workspace = true }
is-macro = { workspace = true }
is-wsl = { workspace = true }
itertools = { workspace = true }
libcst = { workspace = true }
jiff = { workspace = true }

View File

@ -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
/// 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
/// - [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
#[cfg(target_family = "unix")]
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) {
context.report_diagnostic_if_enabled(
ShebangMissingExecutableFile,

View File

@ -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
/// 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
/// ```python
@ -51,13 +55,6 @@ impl Violation for ShebangNotExecutable {
/// EXE001
#[cfg(target_family = "unix")]
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) {
context.report_diagnostic_if_enabled(ShebangNotExecutable, range);
}