So you want to contribute to the Powerline project? Awesome! This document describes the guidelines you should follow when making contributions to the project.
Please note that these guidelines aren't mandatory in any way, but your pull request will be merged a lot faster if you follow them.
develop
branch.feature/
if you're working on a new feature.321-fix-some-error
or feature/123-a-cool-feature
.flake8
and fix any programming style errors. Use
common sense regarding whitespace warnings, not all warnings need to be
fixed.Ref #123
or Fixes #234
at the bottom of the
commit message. Commit messages can use Markdown with the following
exceptions:```
blocks).The project uses tabs for indentation and spaces for alignment, this is also included in a vim modeline on top of every script file.
Run your code through flake8 --ignore=W191,E501,E128,W291,E126,E101
to fix
any style errors. Use common sense regarding whitespace warnings, not all
flake8
warnings need to be fixed.
Trailing whitespace to indicate a continuing paragraph is OK in comments, documentation and commit messages.
It is allowed to have too long lines. It is advised though to avoid lines wider then a hundred of characters.
Imports have the following structure:
Shebang and modeline in a form
#!/usr/bin/env python
# vim:fileencoding=utf-8:noet
. Modeline is required, shebang is not. If shebang is present file must end with
if __name__ == '__main__':
# Actual script here
Module docstring.
__future__
import exactly in a form
from __future__ import (unicode_literals, division, absolute_import, print_function)
(powerline.shell is the only exception due to problems with argparse). It is not separated by newline with shebang and modeline, but is with docstring.
Standard python library imports in a form import X
.
Standard python library imports in a form from X import Y
.
Third-party (non-python and non-powerline) library imports in a form
import X
.
Third-party library imports in a form from X import Y
.
Powerline non-test imports in a form from powerline.X import Y
.
Powerline test imports in a form import tests.vim as vim_module
.
Powerline test imports in a form from tests.X import Y
.
Each entry is separated by newline from another entry. Any entry except for the first and third ones is optional. Example with all entries:
#!/usr/bin/env python
# vim:fileencoding=utf-8:noet
'''Powerline super module'''
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
from argparse import ArgumentParser
import psutil
from colormath.color_diff import delta_e_cie2000
from powerline.lib.unicode import u
import tests.vim as vim_module
from tests import TestCase
git rebase -i <revision>
to squash or reword commits
before submitting a pull request.此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。