{"id":19866711,"url":"https://github.com/sorenlind/flake8-plus","last_synced_at":"2025-06-27T02:33:08.898Z","repository":{"id":62593622,"uuid":"555254836","full_name":"sorenlind/flake8-plus","owner":"sorenlind","description":"Plugin for Flake8 that detects incorrect amounts of vertical whitespace preceding different statements and keywords.","archived":false,"fork":false,"pushed_at":"2024-02-02T12:27:25.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T00:38:26.716Z","etag":null,"topics":["flake8","flake8-plugin","linter-plugin","python","whitespace"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sorenlind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-21T08:18:29.000Z","updated_at":"2024-04-17T06:40:32.000Z","dependencies_parsed_at":"2024-11-12T15:33:00.818Z","dependency_job_id":"924acb6e-f592-417a-9b8d-05f9e668ced1","html_url":"https://github.com/sorenlind/flake8-plus","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"9e77ce2e751e18e198ca139d668f761cd9168e66"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/sorenlind/flake8-plus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorenlind%2Fflake8-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorenlind%2Fflake8-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorenlind%2Fflake8-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorenlind%2Fflake8-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sorenlind","download_url":"https://codeload.github.com/sorenlind/flake8-plus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorenlind%2Fflake8-plus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262177787,"owners_count":23270935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flake8","flake8-plugin","linter-plugin","python","whitespace"],"created_at":"2024-11-12T15:27:01.682Z","updated_at":"2025-06-27T02:33:08.803Z","avatar_url":"https://github.com/sorenlind.png","language":"Python","readme":"# Flake8-plus\n\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/sorenlind/flake8-plus/tree/main.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/sorenlind/flake8-plus/tree/main)\n[![codecov](https://img.shields.io/codecov/c/github/sorenlind/flake8-plus?token=8ULWSRBPNC)](https://codecov.io/gh/sorenlind/flake8-plus)\n[![license](https://black.readthedocs.io/en/stable/_static/license.svg)](https://github.com/sorenlind/flake8-plus/blob/main/LICENSE)\n[![pypi](https://img.shields.io/pypi/v/flake8-plus)](https://pypi.org/project/flake8-plus/)\n[![black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nFlake8-plus is a plugin for [Flake8](https://github.com/PyCQA/flake8) that detects\nincorrect amounts of vertical whitespace before the first toplevel `import` statement,\nbefore `return` statements and before `except`. The plugin can be configured to expect\nany number of blank lines. By default, the plugin expects no blank lines before both the\n`import` and `return` statements, and the `except` keyword.\n\n## Installation\n\nFlake8-plus can be installed from PyPI using `pip`:\n\n```shell\n$ pip install flake8-plus\n```\n\nYou can verify that it has been installed as follows (the version numbers you see may\nvary):\n\n```shell\n$ flake8 --version\n5.0.4 (flake8-plus: 0.1.0, mccabe: 0.7.0, pycodestyle: 2.9.1, pyflakes: 2.5.0)\n```\n\n## Configuration\n\nYou can set the required number of blank lines before the first `import` as well as the\nnumber of blank lines required before a `return` and before `except`. This can be done\nfrom the command line:\n\n```shell\n$ flake8 --blanks-before-imports 1 --blanks-before-return 1 --blanks-before-except 1\n```\n\nOr from one of the `setup.cfg`, `tox.ini`, or `.flake8` files:\n\n```ini\n[flake8]\nblanks-before-imports=1\nblanks-before-return=1\nblanks-before-except=1\n```\n\n## Why no blank lines?\n\n### Before `import`\n\nNeither [Black](https://github.com/psf/black), [Flake8](https://github.com/PyCQA/flake8)\nnor [Pylint](https://github.com/PyCQA/pylint) enforces a specific number of blank lines\npreceding the first `import` and consequently there seems to be no consensus or\nstandard. The table below shows the frequency of the number of blank lines before the\nfirst toplevel `import` statement in the code bases for Black, Flake8 and Pylint (as of\nOctober 2022).\n\n| Package | Total files | 0 blanks | 1 blank | 2 blanks | Folder        |\n| ------- | ----------: | -------: | ------: | -------: | ------------- |\n| Black   |          33 |       21 |      12 |        0 | `src`         |\n| Flake8  |          32 |       32 |       0 |        0 | `src/flake8/` |\n| Pylint  |         177 |        3 |     170 |        4 | `pylint`      |\n\nClearly, there is no real consensus. Black seems undecided, Flake8 consistently uses 0\nblanks, and Pylint seems to prefer 1 blank line. However, it's worth noting that the\nPylint code does not consistently include module docstrings (thereby breaking\n`pylint(missing-module-docstring)`). For that reason, and also because this is a Flake8\nplugin, the plugin follows the style of Flake8 as the default.\n\n### Before `return`\n\nNeither Black, Flake8 nor Pylint enforces a specific number of blank lines preceding\n`return`. However, they all use zero blank lines more frequently than they use any\nother number of blanks. The table below shows the frequency of the number of blank\nlines before a `return` statement in the code bases for Black, Flake8 and Pylint (as of\nOctober 2022).\n\n| Package | Total `return`s | 0 blanks | 1 blank | 2 blanks | Folder        |\n| ------- | --------------: | -------: | ------: | -------: | ------------- |\n| Black   |             618 |      544 |      74 |        0 | `src`         |\n| Flake8  |             174 |      155 |      19 |        0 | `src/flake8/` |\n| Pylint  |            1941 |     1852 |      89 |        0 | `pylint`      |\n\nSince zero blank lines is the style used most frequently, Flake8-plus uses that as that\nas the default.\n\n### Before `except`\n\nNeither Black, Flake8 nor Pylint enforces a specific number of blank lines preceding\n`except`. However, they all use zero blank lines more frequently than they use any other\nnumber of blanks. The table below shows the frequency of the number of blank lines\nbefore an `except` statement in the code bases for Black, Flake8 and Pylint (as of\nOctober 2022).\n\n| Package | Total `except`s | 0 blanks | 1 blank | 2 blanks | Folder        |\n| ------- | --------------: | -------: | ------: | -------: | ------------- |\n| Black   |              71 |       64 |       7 |        0 | `src`         |\n| Flake8  |              26 |       26 |       0 |        0 | `src/flake8/` |\n| Pylint  |             285 |      283 |       2 |        0 | `pylint`      |\n\nSince zero blank lines is the style used most frequently, Flake8-plus uses that as that\nas the default.\n\n## Reported problems\n\n| Code   |  Description                                                |\n| ------ | ----------------------------------------------------------- |\n| PLU001 | \"expected {} blank lines before first import, found {}\"     |\n| PLU002 | \"expected {} blank lines before return statement, found {}\" |\n| PLU003 | \"expected {} blank lines before except, found {}\"           |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsorenlind%2Fflake8-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsorenlind%2Fflake8-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsorenlind%2Fflake8-plus/lists"}