[FR] Run clang-format on C files

Open
#5,982 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
c
Domain
tooling

Research direction

Start by reviewing the C files under src and the referenced clang-format documentation and Stan math configuration. Decide the project formatting settings, apply clang-format across the requested files, and consider the mentioned .clang-format and .git-blame-ignore-revs files. Done means the src C files are consistently formatted and the formatting changes are reviewable.

Written by the indexing model from the issue text.

Description

code-quality internals

I'm reading through rbindlist.c and there are several lines like

    for (int j=0; j<thisncol; ++j) { int tt=length(VECTOR_ELT(li,j)); if (tt>maxLen) { maxLen=tt; whichMax=j; } }

It would be nice to run clang-format over all of the c files in src just to make these lines more easily parsable.

Eigen and the Stan math have done this and there's a lot of discussion around the pros and cons. The main con being that you have one hard break in your git, but that can be resolved by adding a .git-blame-ignore-revs file that ignores the reformatting. A .clang-format file can be included to modify any of the defaults as the team wishes

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.