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

Switching to Pytorch's clang-formatter. #2872

Merged
merged 2 commits into from
Oct 22, 2020

Conversation

datumbox
Copy link
Contributor

Fixing #2372 by using option 2.

@datumbox datumbox requested a review from fmassa October 22, 2020 09:37
Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me.

I don't know who maintains the oss-clang-format on PyTorch side though, so it would be good to let them know that we started using it.

cc @seemethere if you know who maintains it.

./travis-scripts/run-clang-format/run-clang-format.py -r torchvision/csrc
curl https://oss-clang-format.s3.us-east-2.amazonaws.com/linux64/clang-format-linux64 -o clang-format
chmod +x clang-format
sudo mv clang-format /opt/clang-format
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do we need to move this to /opt/clang-format if we can specify a --clang-format-executable in the script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really necessary. I did not want to leave a binary in the root of the project. Can make a change if you want.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, it was just for my information.

@fmassa fmassa merged commit 8a0434d into pytorch:master Oct 22, 2020
@datumbox datumbox deleted the ci/fix-clang-version branch October 22, 2020 11:51
@mthrok
Copy link
Contributor

mthrok commented Oct 22, 2020

@datumbox if you have time, could you port this to torchaudio and torchtext?

@datumbox
Copy link
Contributor Author

@mthrok I can have a look. From what I see, the 2 projects don't have clang-format setup on CI.

So basically the task looks like:

  1. Create a circleci task
  2. Copy the travis-scripts/run-clang-format files to audio/text
  3. Run the script and fix any formatting issues
  4. Submit a PR in each project

Does that sound OK?

@mthrok
Copy link
Contributor

mthrok commented Oct 22, 2020

Both projects do have jobs for linting, and they should be identical.

The CI job is defined here;
https://github.com/pytorch/audio/blob/master/.circleci/config.yml.in#L586-L615

Here is the script used; (flake8 + clang_format)
https://github.com/pytorch/audio/blob/master/.circleci/unittest/linux/scripts/run_style_checks.sh

And the job looks like this.
https://app.circleci.com/pipelines/github/pytorch/audio/3651/workflows/c2b4fe73-871a-409a-b4a4-39f2442a37be/jobs/108109

So, changing either the config or the job script to run the same formatter should do.

@fmassa fmassa mentioned this pull request Oct 22, 2020
bryant1410 pushed a commit to bryant1410/vision-1 that referenced this pull request Nov 22, 2020
* Switching to Pytorch's clang-formatter.

* Replacing binary.
vfdev-5 pushed a commit to Quansight/vision that referenced this pull request Dec 4, 2020
* Switching to Pytorch's clang-formatter.

* Replacing binary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants