{"id":20739309,"url":"https://github.com/hanhwanglim/module-level-lint","last_synced_at":"2025-04-24T02:23:30.561Z","repository":{"id":203184618,"uuid":"708735776","full_name":"hanhwanglim/module-level-lint","owner":"hanhwanglim","description":"A Flake8 plugin to enforce code quality by checking module level docstrings, future-imports, and module level dunders as specified in PEP 8","archived":false,"fork":false,"pushed_at":"2024-01-16T11:41:45.000Z","size":53,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T06:03:10.198Z","etag":null,"topics":["flake8","linter","python","python3"],"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/hanhwanglim.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":"2023-10-23T09:32:37.000Z","updated_at":"2024-07-04T16:46:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"9f5cfde7-938a-47f5-a432-bc9367f799da","html_url":"https://github.com/hanhwanglim/module-level-lint","commit_stats":null,"previous_names":["hanhwanglim/module-level-lint"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanhwanglim%2Fmodule-level-lint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanhwanglim%2Fmodule-level-lint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanhwanglim%2Fmodule-level-lint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanhwanglim%2Fmodule-level-lint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hanhwanglim","download_url":"https://codeload.github.com/hanhwanglim/module-level-lint/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250145394,"owners_count":21382408,"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","linter","python","python3"],"created_at":"2024-11-17T06:24:25.889Z","updated_at":"2025-04-24T02:23:30.539Z","avatar_url":"https://github.com/hanhwanglim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Module Level Lint\n\nA Flake8 plugin to enforce code quality by checking module level docstrings, future-imports, and module level dunders as specified in [PEP 8](https://peps.python.org/pep-0008/#module-level-dunder-names)\n\n## Installation\n\nYou can install this plugin via pip:\n\n```bash\npip install module-level-lint\n```\n\n## Usage\n\nAfter installation, you can use this plugin with the `flake8` command. Here's how to run it:\n\n```bash\nflake8 [path]\n```\n\nTo show only module level lint errors, run:\n\n```bash\nflake8 --select MLL [path]\n```\n\nTo show only specific errors\n\n```bash\nflake8 --select MLL001,MLL002 [path]\n```\n\nTo apply formatting\n\n```bash\nflake8 --select MLL [path] --fix\n```\n\n## Features\n\n### Lint\n\n#### Module Docstring Check: Ensure that your docstrings are always at the top of the file\n\n- Linting Error: **MLL001**\n\nExample:\n\n```python\nimport random\n\n# Bad: Module docstring is not at the top of the file\n\"\"\"This is a docstring\"\"\"\n\ndef foo():\n    pass\n```\n\n```python\n# Good: Docstring present at the top of the file\n\"\"\" This is a docstring. \"\"\"\n\ndef foo():\n    pass\n```\n\n#### Future-Imports Check: Ensure that future-imports are always at the top after module docstrings\n\n- Linting Error: **MLL002**\n\nExample:\n\n```python\nimport random\n\n# Bad: Future-imports is not at the top of the file\nfrom __future__ import print_function\n```\n\n```python\n# Good: Future-imports is at the top of the file\nfrom __future__ import division\n\nimport random\n```\n\n- Linting Error: **MLL003**\n\nExample:\n\n```python\nfrom __future__ import print_function\n\n# Bad: Docstring is not at the top of the file\n\"\"\"This is a docstring.\"\"\"\n```\n\n```python\n\"\"\"This is a docstring.\"\"\"\n\n# Good: Future-imports is at the top of the file after docstring\nfrom __future__ import division\n```\n\n#### Module-Level Dunders: Ensure that module level dunders are always at the top after future-imports or docstrings\n\n- Linting Error: **MLL004**\n\nExample:\n\n```python\nimport random\n\n# Bad: Module level dunder after imports\n__all__ = [\"foo\"]\n\ndef foo():\n    pass\n```\n\n```python\n# Bad: Module level dunder before docstring\n__all__ = [\"foo\"]\n\n\"\"\"This is a docstring\"\"\"\n\ndef foo():\n    pass\n```\n\n```python\ndef foo():\n    pass\n\n# Bad: Module level dunder after code\n__all__ = [\"foo\"]\n```\n\n```python\n# Good: Module level dunder at the top of the file\n__all__ = [\"foo\"]\n\ndef foo():\n    pass\n```\n\n### Format\n\nWith the `--fix` flag, this plugin will try to format the files that have no rule violations. It will fix the newlines in the following format:\n\n```python\n\"\"\"Docstring goes here\"\"\"   # An empty line after docstrings\n\nfrom __future__ import annotations  # An empty line after future imports\n\n__all__ = [\"foo\"]  # An empty line after module dunders\n\nimport random   # Rest of the code\n\n\ndef foo():\n    return random.randint(1, 10)\n```\n\n## Configuration\n\nThis plugin doesn't require any specific configuration, but you can include its error codes in your Flake8 configuration file to disable or enable specific checks:\n\n```ini\n[flake8]\nextend-ignore = MLL001, MLL002, MLL003, MLL004\n```\n\n## Contributing\n\nContributions, issues, and feature requests are welcome! Please feel free to submit a pull request or open an issue.\n\n## License\n\nThis plugin is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanhwanglim%2Fmodule-level-lint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhanhwanglim%2Fmodule-level-lint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanhwanglim%2Fmodule-level-lint/lists"}