#8306 Adopt Black code style
Opened by cheimes. Modified

Request for enhancement

Black is the Uncompromising Code Formatter for Python. Auto-formatting with black will give FreeIPA a consistent code style, eliminate any need to discuss code style issues in PRs, and get rid of about remaining 25,000 pycodestyle violations.

Design doc

black-codestyle.rst for FreeIPA

Django DEP 0008


Please no.

This will result in a massive commit that will mess up "blame" output, making it harder (and more effort) to determine history of a line.

We already have tools enforcing style. If we want to change the target style going forward, ok, let's discuss that. But a "big bang" reformatting of the codebase (or "small-bang" on a file-by-file basis) does more harm than good.

Please no.
This will result in a massive commit that will mess up "blame" output, making it harder (and more effort) to determine history of a line.

My design doc in https://github.com/freeipa/freeipa/pull/4621 explains why it's not going to mess up git blame. The --ignore-revs-file option to git blame allow us to define a file with commit hashses that are ignored by git blame. Developers can persist the configuration with git config --local blame.ignoreRevsFile .gitignorerevs, too.

master:

  • 86d76efcef3ca1336a686795c5aa27e813d8e89a Fix E266 too many leading '#' for block comment
  • 9661807385d8ecf1a5ee9aa446d4ad7644a54ec0 Fix E711 comparison to None
  • 690b5519f86545ef6705c53c16c1f3474cb0d656 Fix E712 comparison to True / False
  • d0818e1809a6520f42fd945cae1a69949a7e948f Fix E713 test for membership should be 'not in'
  • 8c9bba8e1ad1def3745497de24b14786148a64af Fix E714 test for object identity should be 'is not'
  • 31fa527e1b2fc626d941081ae1764b0bb4d20612 Fix E721 do not compare types, use 'isinstance()'
  • 186d739d7f54989e9ed6ea08371825b29f21b811 Fix E722 do not use bare 'except'
  • c544d18f1a80808ab8c087db751b2074d23f06ce Silence W601 .has_key() is deprecated
  • 6386c0cbdd990b065066818a41e91fa9504af1ad Manually reformat ipapython/version.py.in
  • f6be661244f0fa7ee74afa1587e39a3f8e04ac6a Reconfigure pycodestyle

ipa-4-8:

  • 033f8dc626c0ad2e13594d964869b72cad228142 Fix E266 too many leading '#' for block comment
  • c136aab0f87ac5b53db3193e0f1a4cd0cc5c832f Fix E711 comparison to None
  • 01c1cf67e5e88a4af7f149652af378d36f64a471 Fix E712 comparison to True / False
  • ef068bd30dddcc653726bd2602be288bef351385 Fix E713 test for membership should be 'not in'
  • 70dc448280496edcc4971b60ece044cbbec10840 Fix E714 test for object identity should be 'is not'
  • 7be2ffea6a93e1d16e548bcb1d4870dccbe38c8c Fix E721 do not compare types, use 'isinstance()'
  • 45ddb4f17492bedfcf4e144c14ee0a5f03c1231c Fix E722 do not use bare 'except'
  • d44a392568bfbe058407f7ab3169a5778ec528b6 Silence W601 .has_key() is deprecated
  • 9c3d00b17570104f4a1bc7a802496f515e810ae6 Manually reformat ipapython/version.py.in
  • d80b98b9daff3da019542117bd52d349a101eab8 Reconfigure pycodestyle
Metadata