Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: configure isort for code formatting #76

Closed
williballenthin opened this issue Jul 2, 2020 · 5 comments · Fixed by #150
Closed

ci: configure isort for code formatting #76

williballenthin opened this issue Jul 2, 2020 · 5 comments · Fixed by #150
Assignees
Labels
CI Continuous Integration configuration enhancement New feature or request

Comments

@williballenthin
Copy link
Collaborator

williballenthin commented Jul 2, 2020

$ isort --length-sort --line-width 120 --thirdparty idc --thirdparty idaapi --thirdparty idautils --thirdparty ida_gdl --thirdparty PyQt5 --thirdparty argparse --builtin posixpath --thirdparty tabulate --thirdparty viv_utils --recursive .
@williballenthin williballenthin added the enhancement New feature or request label Jul 2, 2020
@williballenthin
Copy link
Collaborator Author

run this before black, due to some line width differences.

@williballenthin williballenthin added the CI Continuous Integration configuration label Jul 2, 2020
@Ana06
Copy link
Member

Ana06 commented Jul 15, 2020

I think we should use isort5. It includes a black profile (see PyCQA/isort#694)

isort --profile black --length-sort --line-width 120 .
black -l 120 .

Running it this way black doesn't change things back.

Note that isort5 has removed the recursive option (which is the default now) and changed the module placement which affects the thirdparty option. So I am not sure if we need/want to add more options to sort. @williballenthin please let me know if more options are needed, so that I add this to the ci.

@williballenthin
Copy link
Collaborator Author

williballenthin commented Jul 15, 2020

can you summarize how our code style will change by using these different options? maybe include a snippet or two that shows the changes.

given that we always run isort and then black, i'm not too concerned if there are minor incompatibilities. but, if there's a recommended way of keeping things in sync, and it matches our code style, that's definitely best.

@Ana06
Copy link
Member

Ana06 commented Jul 16, 2020

You can see the changes here: f4e6541

Some changes seems related to argparse not being a third party library. The rest seems to be improvements in the new version.

@williballenthin
Copy link
Collaborator Author

the changes look very reasonable. i'm on board.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration configuration enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants