So you think you can contribute to Medusa? We gladly have you on board! There are some pointers we'd like you give you before you start hacking into the code first. Contributions are always welcome. But if they're not using our guidelines, we can't allow that new cool feature or critical bugfix. The developers of this project have agreed on following some rules, that should improve the overall quality.
In general, we follow the "fork-and-pull" Git workflow.
Be sure to rebase on top of the latest from "upstream" before making a pull request!
It is always possible to request a topic branch, with one if the team members. They will create one for you, which can be used instead of your local fork. The rest of the workflow will be exactly the same, with the benifit of having more users to test your code.
Medusa makes use of python, javascript, css, and html (Mako templated) code. As you might understand it is important that we follow the guidelines for each of these languages. To help you get started we provide you with some basic guidelines per language.
We follow the PEP8 styleguide. Please visit the official https://www.python.org/dev/peps/pep-0008/ styleguide.
Additionally we follow these rules:
After making a change to the logger module, we are able to make use of lazy logging throughout the Medusa codebase. For more on this topic please refer to: https://docs.python.org/2/library/logging.html as a starting point.
Please use the following example for when adding logs.
# At the top of the module
import logging
from medusa.logger.adapters.style import BraceAdapter
log = BraceAdapter(logging.getLogger(__name__))
log.logger.addHandler(logging.NullHandler())
# For each log line
log.info('{param1} {param2}', {'param1': 'nice', 'param2': 'catch'})
When you want to format a string and it's not for the purpose of a log message, please use the str.format() method. The following formats are allowed:
'Did not find any results for show {0} on provider {1}'.format(show, provider)
# or
'Did not find any results for show {show} on provider {provider}'.format(show=show, provider=provider)
We follow Google's Javascript guide: https://google.github.io/styleguide/javascriptguide.xml
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。