<p>不幸的是,“pep8风暴”(整个项目)有几个负面影响:</p>
<ul>
<li>很多合并冲突</li>
<li>不负责任</li>
<li>使代码复查困难</li>
</ul>
<p>作为另一种选择(多亏了<a href="https://github.com/pydata/pandas/issues/6248" rel="noreferrer">@y-p for the idea</a>),我编写了一个小包,它只自动部署自上次提交/分支以来您一直在处理的那些行:</p>
<h3><em>基本上只剩下一点</em><a href="https://github.com/hayd/pep8radius" rel="noreferrer">better than you found it</a>:</h3>
<pre><code>pip install pep8radius
</code></pre>
<p>假设您已经完成了<code>master</code>的工作并准备提交:</p>
<pre><code># be somewhere in your project directory
# see the diff with pep, see the changes you've made since master
pep8radius master --diff
# make those changes
pep8radius master --diff --in-place
</code></pre>
<p>或者清除自上次提交以来提交的新行:</p>
<pre><code>pep8radius --diff
pep8radius --diff --in-place
# the lines which changed since a specific commit `git diff 98f51f`
pep8radius 98f51f --diff
</code></pre>
<p><em>基本上<a href="https://github.com/hayd/pep8radius" rel="noreferrer">^{<cd2>}</a>是对git/hg diff(来自<a href="https://stackoverflow.com/questions/23975995/git-diff-branch-against-working-tree-not-including-merges">the last shared commit</a>)输出中的行应用autopep8。</em></p>
<p>这个脚本目前与git和hg一起工作,如果您使用了其他东西,并且希望它工作<a href="https://github.com/hayd/btyfi/issues/5" rel="noreferrer">please post a comment/issue/PR</a>!</p>