diff options
Diffstat (limited to 'docs/contributing/2.-coding-standard.html')
-rw-r--r-- | docs/contributing/2.-coding-standard.html | 1570 |
1 files changed, 1570 insertions, 0 deletions
diff --git a/docs/contributing/2.-coding-standard.html b/docs/contributing/2.-coding-standard.html new file mode 100644 index 00000000..e26c14ed --- /dev/null +++ b/docs/contributing/2.-coding-standard.html @@ -0,0 +1,1570 @@ + +<!doctype html> +<html lang="en" class="no-js"> + <head> + + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width,initial-scale=1"> + + + + + <link rel="icon" href="../../art/logo.png"> + <meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.8"> + + + + <title>2. Coding Standard - isort</title> + + + + <link rel="stylesheet" href="../../assets/stylesheets/main.ca7ac06f.min.css"> + + + <link rel="stylesheet" href="../../assets/stylesheets/palette.f1a3b89f.min.css"> + + + + + + + + <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> + <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback"> + <style>:root{--md-text-font-family:"Roboto";--md-code-font-family:"Roboto Mono"}</style> + + + + + <link rel="stylesheet" href="../../art/stylesheets/extra.css"> + + + + + + + + </head> + + + + + + + + <body dir="ltr" data-md-color-scheme="isort" data-md-color-primary="" data-md-color-accent=""> + + + <script>function __prefix(e){return new URL("../..",location).pathname+"."+e}function __get(e,t=localStorage){return JSON.parse(t.getItem(__prefix(e)))}</script> + + <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off"> + <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off"> + <label class="md-overlay" for="__drawer"></label> + <div data-md-component="skip"> + + + <a href="#hope-8-style-guide-for-hug-code" class="md-skip"> + Skip to content + </a> + + </div> + <div data-md-component="announce"> + + </div> + + <header class="md-header" data-md-component="header"> + <nav class="md-header__inner md-grid" aria-label="Header"> + <a href="../../index.html" title="isort" class="md-header__button md-logo" aria-label="isort" data-md-component="logo"> + + <img src="../../art/logo.png" alt="logo"> + + </a> + <label class="md-header__button md-icon" for="__drawer"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg> + </label> + <div class="md-header__title" data-md-component="header-title"> + <div class="md-header__ellipsis"> + <div class="md-header__topic"> + <span class="md-ellipsis"> + isort + </span> + </div> + <div class="md-header__topic" data-md-component="header-topic"> + <span class="md-ellipsis"> + + 2. Coding Standard + + </span> + </div> + </div> + </div> + + + + <label class="md-header__button md-icon" for="__search"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg> + </label> + +<div class="md-search" data-md-component="search" role="dialog"> + <label class="md-search__overlay" for="__search"></label> + <div class="md-search__inner" role="search"> + <form class="md-search__form" name="search"> + <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active" required> + <label class="md-search__icon md-icon" for="__search"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg> + </label> + <button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg> + </button> + </form> + <div class="md-search__output"> + <div class="md-search__scrollwrap" data-md-scrollfix> + <div class="md-search-result" data-md-component="search-result"> + <div class="md-search-result__meta"> + Initializing search + </div> + <ol class="md-search-result__list"></ol> + </div> + </div> + </div> + </div> +</div> + + + <div class="md-header__source"> + +<a href="https://github.com/timothycrosley/isort/" title="Go to repository" class="md-source" data-md-component="source"> + <div class="md-source__icon md-icon"> + + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg> + </div> + <div class="md-source__repository"> + isort + </div> +</a> + </div> + + </nav> +</header> + + <div class="md-container" data-md-component="container"> + + + + + <main class="md-main" data-md-component="main"> + <div class="md-main__inner md-grid"> + + + + <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" > + <div class="md-sidebar__scrollwrap"> + <div class="md-sidebar__inner"> + + + +<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0"> + <label class="md-nav__title" for="__drawer"> + <a href="../../index.html" title="isort" class="md-nav__button md-logo" aria-label="isort" data-md-component="logo"> + + <img src="../../art/logo.png" alt="logo"> + + </a> + isort + </label> + + <div class="md-nav__source"> + +<a href="https://github.com/timothycrosley/isort/" title="Go to repository" class="md-source" data-md-component="source"> + <div class="md-source__icon md-icon"> + + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg> + </div> + <div class="md-source__repository"> + isort + </div> +</a> + </div> + + <ul class="md-nav__list" data-md-scrollfix> + + + + + + + + + <li class="md-nav__item"> + <a href="../../index.html" class="md-nav__link"> + Home + </a> + </li> + + + + + + + + + + + <li class="md-nav__item"> + <a href="../../CHANGELOG.html" class="md-nav__link"> + Changelog + </a> + </li> + + + + + + + + + + + + <li class="md-nav__item md-nav__item--nested"> + + + <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3" type="checkbox" id="__nav_3" > + + <label class="md-nav__link" for="__nav_3"> + Configuration + <span class="md-nav__icon md-icon"></span> + </label> + <nav class="md-nav" aria-label="Configuration" data-md-level="1"> + <label class="md-nav__title" for="__nav_3"> + <span class="md-nav__icon md-icon"></span> + Configuration + </label> + <ul class="md-nav__list" data-md-scrollfix> + + + + + + <li class="md-nav__item"> + <a href="../configuration/action_comments.html" class="md-nav__link"> + Action Comments + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../configuration/add_or_remove_imports.html" class="md-nav__link"> + Add Or Remove Imports + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../configuration/black_compatibility.html" class="md-nav__link"> + Black Compatibility + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../configuration/config_files.html" class="md-nav__link"> + Config Files + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../configuration/custom_sections_and_ordering.html" class="md-nav__link"> + Custom Sections And Ordering + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../configuration/git_hook.html" class="md-nav__link"> + Git Hook + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../configuration/github_action.html" class="md-nav__link"> + Github Action + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../configuration/multi_line_output_modes.html" class="md-nav__link"> + Multi Line Output Modes + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../configuration/options.html" class="md-nav__link"> + Options + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../configuration/pre-commit.html" class="md-nav__link"> + Pre Commit + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../configuration/profiles.html" class="md-nav__link"> + Profiles + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../configuration/setuptools_integration.html" class="md-nav__link"> + Setuptools Integration + </a> + </li> + + + + </ul> + </nav> + </li> + + + + + + + + + + + + + + <li class="md-nav__item md-nav__item--active md-nav__item--nested"> + + + <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4" type="checkbox" id="__nav_4" checked> + + <label class="md-nav__link" for="__nav_4"> + Contributing + <span class="md-nav__icon md-icon"></span> + </label> + <nav class="md-nav" aria-label="Contributing" data-md-level="1"> + <label class="md-nav__title" for="__nav_4"> + <span class="md-nav__icon md-icon"></span> + Contributing + </label> + <ul class="md-nav__list" data-md-scrollfix> + + + + + + <li class="md-nav__item"> + <a href="1.-contributing-guide.html" class="md-nav__link"> + 1. Contributing Guide + </a> + </li> + + + + + + + + + + <li class="md-nav__item md-nav__item--active"> + + <input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc"> + + + + + + <label class="md-nav__link md-nav__link--active" for="__toc"> + 2. Coding Standard + <span class="md-nav__icon md-icon"></span> + </label> + + <a href="2.-coding-standard.html" class="md-nav__link md-nav__link--active"> + 2. Coding Standard + </a> + + +<nav class="md-nav md-nav--secondary" aria-label="Table of contents"> + + + + + + + <label class="md-nav__title" for="__toc"> + <span class="md-nav__icon md-icon"></span> + Table of contents + </label> + <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix> + + <li class="md-nav__item"> + <a href="#introduction" class="md-nav__link"> + Introduction + </a> + +</li> + + <li class="md-nav__item"> + <a href="#pep-8-foundation" class="md-nav__link"> + PEP 8 Foundation + </a> + +</li> + + <li class="md-nav__item"> + <a href="#line-length" class="md-nav__link"> + Line Length + </a> + +</li> + + <li class="md-nav__item"> + <a href="#descriptive-variable-names" class="md-nav__link"> + Descriptive Variable names + </a> + +</li> + + <li class="md-nav__item"> + <a href="#adding-new-modules" class="md-nav__link"> + Adding new modules + </a> + +</li> + + <li class="md-nav__item"> + <a href="#automated-code-cleaners" class="md-nav__link"> + Automated Code Cleaners + </a> + +</li> + + <li class="md-nav__item"> + <a href="#automated-code-linting" class="md-nav__link"> + Automated Code Linting + </a> + +</li> + + </ul> + +</nav> + + </li> + + + + + + + + <li class="md-nav__item"> + <a href="3.-code-of-conduct.html" class="md-nav__link"> + 3. Code Of Conduct + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="4.-acknowledgements.html" class="md-nav__link"> + 4. Acknowledgements + </a> + </li> + + + + </ul> + </nav> + </li> + + + + + + + + + + + + <li class="md-nav__item md-nav__item--nested"> + + + <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5" type="checkbox" id="__nav_5" > + + <label class="md-nav__link" for="__nav_5"> + Major Releases + <span class="md-nav__icon md-icon"></span> + </label> + <nav class="md-nav" aria-label="Major Releases" data-md-level="1"> + <label class="md-nav__title" for="__nav_5"> + <span class="md-nav__icon md-icon"></span> + Major Releases + </label> + <ul class="md-nav__list" data-md-scrollfix> + + + + + + <li class="md-nav__item"> + <a href="../major_releases/introducing_isort_5.html" class="md-nav__link"> + Introducing Isort 5 + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../major_releases/release_policy.html" class="md-nav__link"> + Release Policy + </a> + </li> + + + + </ul> + </nav> + </li> + + + + + + + + + + + + <li class="md-nav__item md-nav__item--nested"> + + + <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6" type="checkbox" id="__nav_6" > + + <label class="md-nav__link" for="__nav_6"> + Quick Start + <span class="md-nav__icon md-icon"></span> + </label> + <nav class="md-nav" aria-label="Quick Start" data-md-level="1"> + <label class="md-nav__title" for="__nav_6"> + <span class="md-nav__icon md-icon"></span> + Quick Start + </label> + <ul class="md-nav__list" data-md-scrollfix> + + + + + + <li class="md-nav__item"> + <a href="../quick_start/0.-try.html" class="md-nav__link"> + 0. Try + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../quick_start/1.-install.html" class="md-nav__link"> + 1. Install + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../quick_start/2.-cli.html" class="md-nav__link"> + 2. Cli + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../quick_start/3.-api.html" class="md-nav__link"> + 3. Api + </a> + </li> + + + + </ul> + </nav> + </li> + + + + + + + + + + + + <li class="md-nav__item md-nav__item--nested"> + + + <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7" type="checkbox" id="__nav_7" > + + <label class="md-nav__link" for="__nav_7"> + Upgrade Guides + <span class="md-nav__icon md-icon"></span> + </label> + <nav class="md-nav" aria-label="Upgrade Guides" data-md-level="1"> + <label class="md-nav__title" for="__nav_7"> + <span class="md-nav__icon md-icon"></span> + Upgrade Guides + </label> + <ul class="md-nav__list" data-md-scrollfix> + + + + + + <li class="md-nav__item"> + <a href="../upgrade_guides/5.0.0.html" class="md-nav__link"> + 5.0.0 + </a> + </li> + + + + </ul> + </nav> + </li> + + + + + + + + + + + + <li class="md-nav__item md-nav__item--nested"> + + + <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_8" type="checkbox" id="__nav_8" > + + <label class="md-nav__link" for="__nav_8"> + Warning And Error Codes + <span class="md-nav__icon md-icon"></span> + </label> + <nav class="md-nav" aria-label="Warning And Error Codes" data-md-level="1"> + <label class="md-nav__title" for="__nav_8"> + <span class="md-nav__icon md-icon"></span> + Warning And Error Codes + </label> + <ul class="md-nav__list" data-md-scrollfix> + + + + + + <li class="md-nav__item"> + <a href="../warning_and_error_codes/W0500.html" class="md-nav__link"> + W0500 + </a> + </li> + + + + </ul> + </nav> + </li> + + + + + + + + + + + + <li class="md-nav__item md-nav__item--nested"> + + + <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_9" type="checkbox" id="__nav_9" > + + <label class="md-nav__link" for="__nav_9"> + Reference + <span class="md-nav__icon md-icon"></span> + </label> + <nav class="md-nav" aria-label="Reference" data-md-level="1"> + <label class="md-nav__title" for="__nav_9"> + <span class="md-nav__icon md-icon"></span> + Reference + </label> + <ul class="md-nav__list" data-md-scrollfix> + + + + + + + <li class="md-nav__item md-nav__item--nested"> + + + <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_9_1" type="checkbox" id="__nav_9_1" > + + <label class="md-nav__link" for="__nav_9_1"> + Isort + <span class="md-nav__icon md-icon"></span> + </label> + <nav class="md-nav" aria-label="Isort" data-md-level="2"> + <label class="md-nav__title" for="__nav_9_1"> + <span class="md-nav__icon md-icon"></span> + Isort + </label> + <ul class="md-nav__list" data-md-scrollfix> + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/api.html" class="md-nav__link"> + API + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/comments.html" class="md-nav__link"> + Comments + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/core.html" class="md-nav__link"> + Core + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/exceptions.html" class="md-nav__link"> + Exceptions + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/files.html" class="md-nav__link"> + Files + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/format.html" class="md-nav__link"> + Format + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/hooks.html" class="md-nav__link"> + Hooks + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/identify.html" class="md-nav__link"> + Identify + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/index.html" class="md-nav__link"> + Index + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/io.html" class="md-nav__link"> + Io + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/literal.html" class="md-nav__link"> + Literal + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/logo.html" class="md-nav__link"> + Logo + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/main.html" class="md-nav__link"> + Main + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/output.html" class="md-nav__link"> + Output + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/parse.html" class="md-nav__link"> + Parse + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/place.html" class="md-nav__link"> + Place + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/profiles.html" class="md-nav__link"> + Profiles + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/pylama_isort.html" class="md-nav__link"> + Pylama Isort + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/sections.html" class="md-nav__link"> + Sections + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/settings.html" class="md-nav__link"> + Settings + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/setuptools_commands.html" class="md-nav__link"> + Setuptools Commands + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/sorting.html" class="md-nav__link"> + Sorting + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/utils.html" class="md-nav__link"> + Utils + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/wrap.html" class="md-nav__link"> + Wrap + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/wrap_modes.html" class="md-nav__link"> + Wrap Modes + </a> + </li> + + + + + + + + + <li class="md-nav__item md-nav__item--nested"> + + + <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_9_1_26" type="checkbox" id="__nav_9_1_26" > + + <label class="md-nav__link" for="__nav_9_1_26"> + Deprecated + <span class="md-nav__icon md-icon"></span> + </label> + <nav class="md-nav" aria-label="Deprecated" data-md-level="3"> + <label class="md-nav__title" for="__nav_9_1_26"> + <span class="md-nav__icon md-icon"></span> + Deprecated + </label> + <ul class="md-nav__list" data-md-scrollfix> + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/deprecated/finders.html" class="md-nav__link"> + Finders + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/deprecated/index.html" class="md-nav__link"> + Index + </a> + </li> + + + + </ul> + </nav> + </li> + + + + + + + + + <li class="md-nav__item md-nav__item--nested"> + + + <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_9_1_27" type="checkbox" id="__nav_9_1_27" > + + <label class="md-nav__link" for="__nav_9_1_27"> + Stdlibs + <span class="md-nav__icon md-icon"></span> + </label> + <nav class="md-nav" aria-label="Stdlibs" data-md-level="3"> + <label class="md-nav__title" for="__nav_9_1_27"> + <span class="md-nav__icon md-icon"></span> + Stdlibs + </label> + <ul class="md-nav__list" data-md-scrollfix> + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/stdlibs/all.html" class="md-nav__link"> + All + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/stdlibs/index.html" class="md-nav__link"> + Index + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/stdlibs/py2.html" class="md-nav__link"> + Py2 + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/stdlibs/py27.html" class="md-nav__link"> + Py27 + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/stdlibs/py3.html" class="md-nav__link"> + Py3 + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/stdlibs/py35.html" class="md-nav__link"> + Py35 + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/stdlibs/py36.html" class="md-nav__link"> + Py36 + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/stdlibs/py37.html" class="md-nav__link"> + Py37 + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/stdlibs/py38.html" class="md-nav__link"> + Py38 + </a> + </li> + + + + + + + + <li class="md-nav__item"> + <a href="../../reference/isort/stdlibs/py39.html" class="md-nav__link"> + Py39 + </a> + </li> + + + + </ul> + </nav> + </li> + + + + </ul> + </nav> + </li> + + + + </ul> + </nav> + </li> + + + + </ul> +</nav> + </div> + </div> + </div> + + + + <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" > + <div class="md-sidebar__scrollwrap"> + <div class="md-sidebar__inner"> + +<nav class="md-nav md-nav--secondary" aria-label="Table of contents"> + + + + + + + <label class="md-nav__title" for="__toc"> + <span class="md-nav__icon md-icon"></span> + Table of contents + </label> + <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix> + + <li class="md-nav__item"> + <a href="#introduction" class="md-nav__link"> + Introduction + </a> + +</li> + + <li class="md-nav__item"> + <a href="#pep-8-foundation" class="md-nav__link"> + PEP 8 Foundation + </a> + +</li> + + <li class="md-nav__item"> + <a href="#line-length" class="md-nav__link"> + Line Length + </a> + +</li> + + <li class="md-nav__item"> + <a href="#descriptive-variable-names" class="md-nav__link"> + Descriptive Variable names + </a> + +</li> + + <li class="md-nav__item"> + <a href="#adding-new-modules" class="md-nav__link"> + Adding new modules + </a> + +</li> + + <li class="md-nav__item"> + <a href="#automated-code-cleaners" class="md-nav__link"> + Automated Code Cleaners + </a> + +</li> + + <li class="md-nav__item"> + <a href="#automated-code-linting" class="md-nav__link"> + Automated Code Linting + </a> + +</li> + + </ul> + +</nav> + </div> + </div> + </div> + + + <div class="md-content" data-md-component="content"> + <article class="md-content__inner md-typeset"> + + + <a href="https://github.com/pycqa/isort/edit/main/docs/contributing/2.-coding-standard.md" title="Edit this page" class="md-content__button md-icon"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg> + </a> + + + <h1 id="hope-8-style-guide-for-hug-code">HOPE 8 -- Style Guide for Hug Code</h1> +<table> +<thead> +<tr> +<th></th> +<th></th> +</tr> +</thead> +<tbody> +<tr> +<td>HOPE:</td> +<td>8</td> +</tr> +<tr> +<td>Title:</td> +<td>Style Guide for Hug Code</td> +</tr> +<tr> +<td>Author(s):</td> +<td>Timothy Crosley <a href="mailto:timothy.crosley@gmail.com">timothy.crosley@gmail.com</a></td> +</tr> +<tr> +<td>Status:</td> +<td>Active</td> +</tr> +<tr> +<td>Type:</td> +<td>Process</td> +</tr> +<tr> +<td>Created:</td> +<td>19-May-2019</td> +</tr> +<tr> +<td>Updated:</td> +<td>17-August-2019</td> +</tr> +</tbody> +</table> +<h2 id="introduction">Introduction</h2> +<p>This document gives coding conventions for the Hug code comprising the Hug core as well as all official interfaces, extensions, and plugins for the framework. +Optionally, projects that use Hug are encouraged to follow this HOPE and link to it as a reference.</p> +<h2 id="pep-8-foundation">PEP 8 Foundation</h2> +<p>All guidelines in this document are in addition to those defined in Python's <a href="https://www.python.org/dev/peps/pep-0008/">PEP 8</a> and <a href="https://www.python.org/dev/peps/pep-0257/">PEP 257</a> guidelines.</p> +<h2 id="line-length">Line Length</h2> +<p>Too short of lines discourage descriptive variable names where they otherwise make sense. +Too long of lines reduce overall readability and make it hard to compare 2 files side by side. +There is no perfect number: but for Hug, we've decided to cap the lines at 100 characters.</p> +<h2 id="descriptive-variable-names">Descriptive Variable names</h2> +<p>Naming things is hard. Hug has a few strict guidelines on the usage of variable names, which hopefully will reduce some of the guesswork: +- No one character variable names. + - Except for x, y, and z as coordinates. +- It's not okay to override built-in functions. + - Except for <code>id</code>. Guido himself thought that shouldn't have been moved to the system module. It's too commonly used, and alternatives feel very artificial. +- Avoid Acronyms, Abbreviations, or any other short forms - unless they are almost universally understand.</p> +<h2 id="adding-new-modules">Adding new modules</h2> +<p>New modules added to the a project that follows the HOPE-8 standard should all live directly within the base <code>PROJECT_NAME/</code> directory without nesting. If the modules are meant only for internal use within the project, they should be prefixed with a leading underscore. For example, def _internal_function. Modules should contain a docstring at the top that gives a general explanation of the purpose and then restates the project's use of the MIT license. +There should be a <code>tests/test_$MODULE_NAME.py</code> file created to correspond to every new module that contains test coverage for the module. Ideally, tests should be 1:1 (one test object per code object, one test method per code method) to the extent cleanly possible.</p> +<h2 id="automated-code-cleaners">Automated Code Cleaners</h2> +<p>All code submitted to Hug should be formatted using Black and isort. +Black should be run with the line length set to 100, and isort with Black compatible settings in place.</p> +<h2 id="automated-code-linting">Automated Code Linting</h2> +<p>All code submitted to hug should run through the following tools:</p> +<ul> +<li>Black and isort verification.</li> +<li>Flake8</li> +<li>flake8-bugbear</li> +<li>Bandit</li> +<li>pep8-naming</li> +<li>vulture</li> +<li>safety</li> +</ul> + + + + + + + + </article> + </div> + </div> + + </main> + + +<footer class="md-footer"> + + <div class="md-footer-nav"> + <nav class="md-footer-nav__inner md-grid"> + + <a href="1.-contributing-guide.html" title="1. Contributing Guide" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev"> + <div class="md-flex__cell md-flex__cell--shrink"> + <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i> + </div> + <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> + <span class="md-flex__ellipsis"> + <span class="md-footer-nav__direction"> + Previous + </span> + 1. Contributing Guide + </span> + </div> + </a> + + + <a href="3.-code-of-conduct.html" title="3. Code Of Conduct" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next"> + <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> + <span class="md-flex__ellipsis"> + <span class="md-footer-nav__direction"> + Next + </span> + 3. Code Of Conduct + </span> + </div> + <div class="md-flex__cell md-flex__cell--shrink"> + <i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i> + </div> + </a> + + </nav> + </div> + + <div class="md-footer-meta md-typeset"> + <div class="md-footer-meta__inner md-grid"> + <div class="md-footer-copyright"> + + Powered by + <a href="http://timothycrosley.github.io/portray">portray.</a> + You too can + <a href="http://timothycrosley.github.io/portray"> + portray</a> + your Python project well using automatic documentation. + </div> + + </div> + </div> +</footer> + + </div> + <div class="md-dialog" data-md-component="dialog"> + <div class="md-dialog__inner md-typeset"></div> + </div> + <script id="__config" type="application/json">{"base": "../..", "features": [], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "search": "../../assets/javascripts/workers/search.b0710199.min.js", "version": null}</script> + + + <script src="../../assets/javascripts/bundle.76f349be.min.js"></script> + + + </body> +</html>
\ No newline at end of file |