hls4ml icon indicating copy to clipboard operation
hls4ml copied to clipboard

autopep8 + clang-format

Open jmduarte opened this issue 4 years ago • 4 comments

Ran autopep8 recursively on all python files with the setup.cfg in the repo:

autopep8 --in-place --aggressive --aggressive *.py -v
[pep8]
ignore = E121,E123,E126,E226,E24,E704,W503,W504
max-line-length = 199

We can combine this with a GitHub action to automatically check/correct PRs: https://github.com/marketplace/actions/autopep8

Let me know what you think!

jmduarte avatar Feb 10 '21 14:02 jmduarte

Can we postpone this until after we merge the Intel backend and flesh out a strtegy for integrating Phil's CNN implementation? It's just one command, we can run it at any point, so I would prefer to merge the big stuff before that.

vloncar avatar Feb 10 '21 15:02 vloncar

@vloncar oh yes definitely!

I should have said this is just a placeholder / for discussion for now. I figured we'd rebase/merge it during a quiet time without other major open PRs.

jmduarte avatar Feb 10 '21 15:02 jmduarte

I tried to use clang-format to format the HLS code with:

---
# BasedOnStyle:  Google
ColumnLimit:     120
IndentWidth:     4
BreakBeforeBraces: Stroustrup
...

One issue is that pragmas are pushed all the way to the left by default, but apparently this will be made configurable in upcoming release: https://reviews.llvm.org/D92753

For now, I'm using a hack I found here: https://stackoverflow.com/questions/31353748/how-could-i-indent-c-pragma-using-clang-format but it's not always working how I would like.

jmduarte avatar Aug 10 '21 03:08 jmduarte

This PR has not been very active recently, but I think we should make some decisions soon and incorporate something along this line.

jmitrevs avatar Sep 18 '22 18:09 jmitrevs

Closed in favor of #678

jmduarte avatar Nov 02 '22 01:11 jmduarte