diff --git a/crates/ruff_linter/src/rules/flake8_executable/rules/shebang_missing_executable_file.rs b/crates/ruff_linter/src/rules/flake8_executable/rules/shebang_missing_executable_file.rs index ef539e53ce..64c35c44b7 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/rules/shebang_missing_executable_file.rs +++ b/crates/ruff_linter/src/rules/flake8_executable/rules/shebang_missing_executable_file.rs @@ -27,7 +27,8 @@ use crate::rules::flake8_executable::helpers::is_executable; /// #!/usr/bin/env python /// ``` /// -/// Otherwise, remove the executable bit from the file (e.g., `chmod -x __main__.py`). +/// Otherwise, remove the executable bit from the file +/// (e.g., `chmod -x __main__.py` or `git update-index --chmod=-x __main__.py`). /// /// 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 @@ -35,6 +36,7 @@ use crate::rules::flake8_executable::helpers::is_executable; /// /// ## References /// - [Python documentation: Executable Python Scripts](https://docs.python.org/3/tutorial/appendix.html#executable-python-scripts) +/// - [Git documentation: `git update-index --chmod`](https://git-scm.com/docs/git-update-index#Documentation/git-update-index.txt---chmod-x) #[derive(ViolationMetadata)] pub(crate) struct ShebangMissingExecutableFile; diff --git a/crates/ruff_linter/src/rules/flake8_executable/rules/shebang_not_executable.rs b/crates/ruff_linter/src/rules/flake8_executable/rules/shebang_not_executable.rs index c885d2f93f..4769d0386f 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/rules/shebang_not_executable.rs +++ b/crates/ruff_linter/src/rules/flake8_executable/rules/shebang_not_executable.rs @@ -22,12 +22,10 @@ use crate::rules::flake8_executable::helpers::is_executable; /// executable. If a file contains a shebang but is not executable, then the /// shebang is misleading, or the file is missing the executable bit. /// -/// If the file is meant to be executable, add a shebang, as in: -/// ```python -/// #!/usr/bin/env python -/// ``` +/// If the file is meant to be executable, add the executable bit to the file +/// (e.g., `chmod +x __main__.py` or `git update-index --chmod=+x __main__.py`). /// -/// Otherwise, remove the executable bit from the file (e.g., `chmod -x __main__.py`). +/// Otherwise, remove the shebang. /// /// 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 @@ -40,6 +38,7 @@ use crate::rules::flake8_executable::helpers::is_executable; /// /// ## References /// - [Python documentation: Executable Python Scripts](https://docs.python.org/3/tutorial/appendix.html#executable-python-scripts) +/// - [Git documentation: `git update-index --chmod`](https://git-scm.com/docs/git-update-index#Documentation/git-update-index.txt---chmod-x) #[derive(ViolationMetadata)] pub(crate) struct ShebangNotExecutable;