Tidy up code formatting with black
Proposal: use black to improve formatting to PEP8 conventions
Comments (50)
-
reporter -
reporter Using Adafruits list of disable for pylint to see if it is happier. Refs
#841→ <<cset b7f82017eae6>>
-
reporter Fixing basestring reference found in ref
#841→ <<cset 1114fd515cbd>>
-
reporter Ignoring bad-continuation C0330 as black disagrees with pylint. Refs
#841→ <<cset 399c3f03b21b>>
-
reporter Ignoring logging-format-interpolation W1202 because I don't agree with it! Refs
#841→ <<cset 11d9e99a0fe6>>
-
reporter Ignoring logging-fstring-interpolation W1203 for the same reason. Refs
#841→ <<cset 40f7dab9a9ca>>
-
This looks like a great idea to me.
-
reporter Thanks @David Platten . Finally managed to reduce the number of code style issues on Codacy rather than increasing them, but that was partly by just disabling more of the pylint checks! I am confident that it is a good discipline to use, but I am wondering now about ditching Codacy and setting up an alternative instead, rather than just fighting pylint all the time. Flake8 appears to be the linter tool to use, but it isn’t an option in Codacy.
I’ll have a look at how the new reports functions work in bitbucket: https://support.atlassian.com/bitbucket-cloud/docs/code-insights/, possibly with the Flake8 reports being part of the pipeline then being analysed by sonarcloud and the report coming into the PR. Or something.
And I think unless @Luuk or anyone else has a better idea or reasonable objection, I think I’ll merge the code in sooner rather than later so we can have a cleaner base to finish off the version 1 release with.
-
Seems to me like a very good idea to unify code formatting and I can’t think of any reasonable objection.
-
Should we use black before committing or would it be possible to build it in a Bitbucket pipeline?
-
reporter I need to think about that. It changes the code, so might be a surprise if it happened after the code is committed. And I’m not sure how that would work.
There might be something that can be done with pre-commit hooks, not sure.
Maybe just a pre-merge check (manually)?
-
reporter I’ll add some docs as to how to use black (is pretty much as default)
-
Manually is fine for me. Just wondered if it was (easily) possible and what you had in mind.
-
reporter Reverting reformatting of skin map array. Refs
#841→ <<cset a28a7804e5e1>>
-
reporter Running black on skin map array again. Refs
#841→ <<cset 63b07ffda3a6>>
-
reporter Merged in issue841useblack (pull request #376)
Use black
Refs
#841but doesn't close it - I'll work on docs and checks for black/flake8 too.→ <<cset caa075ad3672>>
-
reporter Adding sonarcloud test to pipeline. Refs
#841→ <<cset 46d4a6b2d6da>>
-
reporter Last failed for memory error. Tweaking. Refs
#841→ <<cset 9c42074cd0b9>>
-
reporter Removing the size tweaks to see if it builds and if sonar cache is working. Refs
#841→ <<cset 14a476e01afa>>
-
reporter Didn't work. adding debug and hopefully docker image cache. Refs
#841→ <<cset 6fec9c16f809>>
-
reporter Added the docker memory setting back in. Refs
#841→ <<cset a8d268748e16>>
-
reporter UTF-8 characters have become corrupted somewhere along the way. Refs
#841→ <<cset 8a61ed5b4938>>
-
reporter Correcting previous fix! Refs
#841→ <<cset 4789910e4e99>>
-
reporter Moving Django tests directly into pipeline rather than using tox. Refs
#841→ <<cset 619281c5cefa>>
-
reporter Failed due to OpenREM not being installed. Try installing as -e. Refs
#841→ <<cset 27d23b532956>>
-
reporter Need to create artifact to pass coverage report between steps. Refs
#841→ <<cset 2d6f62efa150>>
-
reporter Increasing docker memory from 2048 to max (I think) of 3072. Refs
#841→ <<cset 1013f7f23de0>>
-
reporter soundcloud-scan now works, but sonarcloud-quality-gate fails on memor error. Seeing if splitting them makes a difference (and works). Refs
#841→ <<cset 89733f89a24a>>
-
reporter Setting debug to true to see if it indicates why it fails. Refs
#841→ <<cset 9feef46721b6>>
-
reporter See if doubling the size helps... Refs
#841→ <<cset a494a904e8b9>>
-
reporter final permutation for tonight... Refs
#841→ <<cset f6a096211f66>>
-
reporter syntax error Refs
#841→ <<cset 65976a06d380>>
-
reporter Try and work out where I got to. Setting everything big. Refs
#841→ <<cset 985a23067e71>>
-
reporter Memory setting but not size doubling. Refs
#841→ <<cset 6c11736ab3ec>>
-
reporter Changed sonarcloud qualitygate so last pipeline passed. Trying now with std memory. Refs
#841→ <<cset afbcb081d470>>
-
reporter Updating gitignore for sonarsource files. Refs
#841→ <<cset e1318b0fd7e4>>
-
reporter Making docker service memory really low. Refs
#841→ <<cset c0ab0b08bb45>>
-
reporter Putting the memory use back in, hoping it will pass without additional minutes being charged. Refs
#841→ <<cset c4f2c8785dac>>
-
reporter First attempt at running flake8 in the pipeline. Refs
#841→ <<cset 8baaadbca3dc>>
-
reporter For the moment, no report. Refs
#841→ <<cset f3657bba186b>>
-
reporter Added exit-zero so it will continue even with errors. Refs
#841→ <<cset 5947779f8c5d>>
-
reporter Writing flake8 report. Refs
#841→ <<cset 4a165614e5b8>>
-
reporter Creating directory. Explicitly adding report as artifact. Refs
#841→ <<cset 52d1e7836e2f>>
-
reporter Not going to fix lack of issues going to sonarcloud, but might be faster. Refs
#841→ <<cset b1e360160a5c>>
-
reporter I think this works, appears to locally. Refs
#841→ <<cset 829e8d693c50>>
-
reporter Merged in issue841testblack (pull request #377)
Refs
#841but doesn't fix it because I need to add some developer docs for black.Runs flake8 report first, then creates code quality report for everything, then runs a quality gate check before finally running the django tests. Quality gate is currently set at a low bar for now. Not sure which of code quality or django tests are more likely to fail - whichever it is should go first to save pipeline minutes!
→ <<cset ff50f63ebadc>>
-
reporter Black formatting changes that were missed previously. Refs
#841→ <<cset f807c2b17cd2>>
-
reporter Adding text to developer docs regarding using Black. Developer docs need more attention! Refs
#841→ <<cset fdd9619e1b31>>
-
reporter Have to do django tests first else there is no coverage report! Refs
#841→ <<cset 51f9715415b4>>
-
reporter - changed status to resolved
Merged in issue841BlackDocs (pull request #379)
Fixes
#841More work needs to be done on the developer docs, contribution guidelines etc, but can be done later.
→ <<cset b54a2f4056bb>>
- Log in to comment
Reformatted code with black. Refs
#841. Left out openSkin for now due to outstanding PR #372→ <<cset d8a22e08a17c>>