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

Add clang-format and workflow for consistency #21 #22

Merged
merged 11 commits into from
Oct 25, 2024

Conversation

nikhiljangra264
Copy link
Contributor

#21

  1. Added clang-format rules to ensure consistency across source files.
  2. Added a workflow test clang-format.yml to check code formatting on pull requests and when changes are made to the master branch.

@fffelix-huang
Copy link
Owner

Thanks! I'll be reviewing within couple days.

Copy link
Owner

@fffelix-huang fffelix-huang left a comment

Choose a reason for hiding this comment

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

Hi

There are some small changes to be made.

.github/workflows/clang-format.yml Outdated Show resolved Hide resolved
.github/workflows/clang-format.yml Outdated Show resolved Hide resolved
.clang-format Outdated Show resolved Hide resolved
.clang-format Show resolved Hide resolved
@nikhiljangra264
Copy link
Contributor Author

nikhiljangra264 commented Oct 25, 2024

Hello @fffelix-huang, I have made some changes requested
Please let me know if theres anything

@nikhiljangra264
Copy link
Contributor Author

apart from that I have added clang-format off and on at places like this

// clang-format off
constexpr std::pair<Value, Value> PieceSquareTable[PieceType::PIECE_NB][Square::SQ_NB] = {
    { // Pawn
        {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
        {166, 256}, {192, 256}, {204, 256}, {216, 256}, {216, 256}, {204, 256}, {192, 256}, {166, 256},
        {166, 256}, {192, 256}, {210, 256}, {242, 256}, {242, 256}, {210, 256}, {192, 256}, {166, 256},
        {166, 256}, {192, 256}, {220, 256}, {268, 256}, {268, 256}, {220, 256}, {192, 256}, {166, 256},
        {166, 256}, {192, 256}, {220, 256}, {242, 256}, {242, 256}, {220, 256}, {192, 256}, {166, 256},
        {166, 256}, {192, 256}, {210, 256}, {216, 256}, {216, 256}, {210, 256}, {192, 256}, {166, 256},
        {166, 256}, {192, 256}, {204, 256}, {216, 256}, {216, 256}, {204, 256}, {192, 256}, {166, 256},
        {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
    },
}

to avoid formating on this code even if it exceeds the column width 100

@fffelix-huang
Copy link
Owner

Great! This is better than I expected :)
One last request is to add formatting to Makefile, (make format should apply clang-format all source codes including cpps and hpps).
After this I'll merge this PR!

@nikhiljangra264
Copy link
Contributor Author

I have Added it. so we can run the make format command to format code.
Please take a look

@fffelix-huang fffelix-huang merged commit 50c8d17 into fffelix-huang:master Oct 25, 2024
1 check passed
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.

2 participants