{"id":9747,"library":"flake8-executable","title":"Flake8 Executable Plugin","description":"flake8-executable (v2.1.3) is a Flake8 plugin designed to enforce best practices for executable files, checking for correct shebangs and file permissions. It integrates seamlessly with the Flake8 linter, providing automated checks that help maintain code quality and prevent common script execution issues. The library is actively maintained, with releases primarily focused on Python version compatibility and bug fixes.","status":"active","version":"2.1.3","language":"en","source_language":"en","source_url":"https://github.com/xuhdev/flake8-executable","tags":["flake8","linter","code quality","executable","shebang","permissions"],"install":[{"cmd":"pip install flake8-executable","lang":"bash","label":"Install package"}],"dependencies":[{"reason":"This package is a plugin for Flake8 and requires Flake8 to be installed and run to function.","package":"flake8","optional":false}],"imports":[{"note":"Users typically do not import flake8-executable directly; it's automatically loaded by Flake8. This import is mainly for programmatic version checking.","symbol":"__version__","correct":"from flake8_executable import __version__"}],"quickstart":{"code":"# 1. Install flake8 and flake8-executable\npip install flake8 flake8-executable\n\n# 2. Create an example executable script (e.g., 'myscript.sh')\n# Note: This file should be marked as executable (e.g., chmod +x myscript.sh)\n# and have a shebang.\n# Example 'myscript.sh' content:\n# #!/bin/bash\n# echo \"Hello from a script!\"\n\n# 3. Run flake8 against your project\n# It will automatically detect and use flake8-executable.\n# Example with a specific file:\n# flake8 myscript.sh\n\n# Or to run on your current directory (assuming myscript.sh is there):\n# flake8 .\n\n# Expected output for a correctly configured script (no errors):\n# (No output)\n\n# If 'myscript.sh' had no shebang (EXE001) or wrong permissions (EXE003),\n# flake8 would report it.","lang":"bash","description":"After installing `flake8-executable`, run `flake8` as you normally would. The plugin automatically integrates, checking for issues like missing shebangs (`EXE001`), incorrect shebangs (`EXE002`), or missing executable permissions (`EXE003`). The quickstart demonstrates how to install and run `flake8` with the plugin activated."},"warnings":[{"fix":"Upgrade to Python 3.7 or newer, or pin `flake8-executable<2.1.2` in your project dependencies.","message":"Python 3.6 support was dropped in v2.1.2. Users on Python 3.6 will need to upgrade their Python version or use an older version of flake8-executable (<2.1.2).","severity":"breaking","affected_versions":">=2.1.2"},{"fix":"Ensure `flake8` is installed via `pip install flake8` in the same virtual environment as `flake8-executable`.","message":"flake8-executable requires Flake8 to be installed and available in the same environment. It is a plugin, not a standalone tool. Running `flake8` without a working `flake8` installation will result in a 'command not found' or similar error.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To ignore specific errors, use `ignore = EXE004` in your Flake8 config. To exclude files/directories, use `exclude = my_data_scripts/`.","message":"File detection for 'executable' can sometimes be broader than intended. For example, a file with a shebang but without executable permissions might still be flagged (EXE004) if it's not meant to be executable. Configure Flake8's `exclude` or `ignore` options in `pyproject.toml`, `setup.cfg`, or `.flake8` to manage these.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Install Flake8: `pip install flake8`.","cause":"The `flake8` command-line tool is not installed or not in your system's PATH.","error":"flake8: command not found"},{"fix":"Add a shebang line to the top of the file (e.g., `#!/usr/bin/env python3` or `#!/bin/bash`). If the file is not meant to be executable, remove its executable permissions (`chmod -x filename`).","cause":"flake8-executable detected a file that appears to be an executable (e.g., `chmod +x` was applied) but lacks a `#!` shebang line.","error":"File has no shebang (EXE001)"},{"fix":"Grant executable permission to the file: `chmod +x filename`. If the file is not meant to be executable, remove the shebang line.","cause":"A file with a shebang was detected, implying it should be executable, but it does not have the executable permission bit set.","error":"Executable file is missing executable permission (EXE003)"},{"fix":"Remove the `--check-executable` (or similar) argument. Simply run `flake8` and the plugin will automatically apply its checks.","cause":"You are trying to explicitly enable flake8-executable with a command-line argument, but plugins are typically auto-detected and run by `flake8` without special flags.","error":"flake8: error: unrecognized arguments: --check-executable"}]}