{"id":9748,"library":"flake8-html","title":"flake8-html","description":"flake8-html is a plugin for the flake8 linter that generates an HTML report of code violations, providing a visual and navigable overview of issues. The current version is 0.4.3. It has an infrequent release cadence, primarily updating to maintain compatibility with new versions of flake8.","status":"active","version":"0.4.3","language":"python","source_language":"en","source_url":"https://github.com/lordmauve/flake8-html","tags":["flake8","linting","code quality","html report","development tool","python"],"install":[{"cmd":"pip install flake8-html","lang":"bash","label":"Install plugin"},{"cmd":"pip install flake8 flake8-html","lang":"bash","label":"Install flake8 and plugin"}],"dependencies":[{"reason":"flake8-html is a plugin for flake8 and requires flake8 to be installed and available in the same Python environment to function.","package":"flake8","optional":false}],"imports":[],"quickstart":{"code":"import subprocess\nimport os\n\n# Create a dummy Python file with a flake8 violation\ncode_to_lint = \"\"\"\nimport os\n\ndef my_func( arg1, arg2 ):\n    print( os.path.join(arg1, arg2) )\n\"\"\"\n\nwith open(\"test_code.py\", \"w\") as f:\n    f.write(code_to_lint)\n\n# Ensure the report directory exists\nreport_dir = \"./flake8_html_report\"\nos.makedirs(report_dir, exist_ok=True)\n\n# Run flake8 with the html format\nprint(f\"Running: flake8 --format=html --htmldir={report_dir} .\")\ntry:\n    result = subprocess.run(\n        [\"flake8\", \"--format=html\", f\"--htmldir={report_dir}\", \".\"],\n        capture_output=True,\n        text=True,\n        check=True\n    )\n    print(\"Flake8 HTML report generated successfully.\")\n    print(f\"Report saved to: {os.path.abspath(report_dir)}/report.html\")\nexcept subprocess.CalledProcessError as e:\n    print(f\"Error running flake8: {e}\\n{e.stderr}\")\nexcept FileNotFoundError:\n    print(\"Error: 'flake8' command not found. Please ensure flake8 is installed.\")\nfinally:\n    # Clean up dummy file\n    if os.path.exists(\"test_code.py\"):\n        os.remove(\"test_code.py\")\n    # Optionally, remove the report directory for a clean run next time\n    # import shutil\n    # if os.path.exists(report_dir):\n    #     shutil.rmtree(report_dir)\n","lang":"python","description":"This quickstart demonstrates how to use `flake8-html` via the `flake8` command-line interface. It creates a temporary Python file with a linter violation, runs `flake8` to generate an HTML report, and then cleans up. The `--format=html` and `--htmldir` arguments are essential for generating the report."},"warnings":[{"fix":"Upgrade `flake8-html` to version 0.4.3 or newer: `pip install --upgrade flake8-html`.","message":"Older versions of `flake8-html` (prior to 0.4.3) are incompatible with `flake8` versions 5.0.0 and above.","severity":"breaking","affected_versions":"<0.4.3"},{"fix":"Ensure both `flake8` and `flake8-html` are installed using the same `pip` command or within the same active virtual environment: `pip install flake8 flake8-html`.","message":"For `flake8-html` to be discovered and used by `flake8`, it must be installed in the exact same Python environment (e.g., virtual environment) as `flake8` itself.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always include `--htmldir=<path/to/directory>` in your `flake8` command to specify where the `report.html` file should be saved.","message":"Failing to specify the `--htmldir` argument will prevent the HTML report from being saved to a file, potentially causing the output to be printed to the console in an unreadable format or not generated at all.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'0.4.3':34 'cadenc':40 'code':20,53 'compat':45 'current':31 'develop':57 'flake8':2,5,12,50,51 'flake8-html':1,4 'generat':15 'html':3,6,17,55 'infrequ':38 'issu':29 'lint':52 'linter':13 'maintain':44 'navig':26 'new':47 'overview':27 'plugin':9 'primarili':41 'provid':22 'python':59 'qualiti':54 'releas':39 'report':18,56 'tool':58 'updat':42 'version':32,48 'violat':21 'visual':24","created_at":"2026-04-17T01:20:30.691296+00:00","updated_at":"2026-04-17T01:20:30.691296+00:00","problems":[{"fix":"Install `flake8-html` in the same Python environment as `flake8`: `pip install flake8-html`.","cause":"The `flake8-html` plugin is not installed, or `flake8` cannot find it in the current environment.","error":"Error: unrecognized arguments: --format=html"},{"fix":"Ensure you are using `--htmldir=<path/to/report>` to specify the output directory for the HTML report.","cause":"The `--htmldir` argument was either omitted or specified incorrectly, preventing `flake8-html` from saving the report to disk.","error":"No 'report.html' file was generated in the expected directory."},{"fix":"Upgrade `flake8-html` to the latest version to ensure compatibility: `pip install --upgrade flake8-html`.","cause":"This often occurs when `flake8-html < 0.4.3` is used with `flake8 >= 5.0.0` due to compatibility issues.","error":"The generated HTML report is empty or appears incomplete despite having linter violations."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/lordmauve/flake8-html","docs":null,"changelog":null,"pypi":"https://pypi.org/project/flake8-html/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-04-17","next_check":"2026-07-16","install_tag":null}}