Flake8 Executable Plugin

2.1.3 · active · verified Fri Apr 17

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.

Common errors

Warnings

Install

Imports

Quickstart

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.

# 1. Install flake8 and flake8-executable
pip install flake8 flake8-executable

# 2. Create an example executable script (e.g., 'myscript.sh')
# Note: This file should be marked as executable (e.g., chmod +x myscript.sh)
# and have a shebang.
# Example 'myscript.sh' content:
# #!/bin/bash
# echo "Hello from a script!"

# 3. Run flake8 against your project
# It will automatically detect and use flake8-executable.
# Example with a specific file:
# flake8 myscript.sh

# Or to run on your current directory (assuming myscript.sh is there):
# flake8 .

# Expected output for a correctly configured script (no errors):
# (No output)

# If 'myscript.sh' had no shebang (EXE001) or wrong permissions (EXE003),
# flake8 would report it.

view raw JSON →