Skip to content

style: run clang-format #2065

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

Merged
merged 3 commits into from
Jun 29, 2025
Merged

style: run clang-format #2065

merged 3 commits into from
Jun 29, 2025

Conversation

e-kwsm
Copy link
Collaborator

@e-kwsm e-kwsm commented Jun 24, 2025

Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

@@ -43,15 +43,18 @@ class ArrayRefContainer
explicit ArrayRefContainer(const size_t n,
const ValueType& value = ValueType())
: m_ref(1), data(n, value)
{}
Copy link
Member

Choose a reason for hiding this comment

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

I definitely don't like this change. It's adding a lot of un-needed linebreaks.

AllowShortBlocksOnASingleLine: Empty

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ugh, I tried Empty but it does not work as expected.

I am using clang-format 20.1.6.

Copy link
Member

Choose a reason for hiding this comment

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

@@ -107,7 +107,8 @@ private slots:
result()
: inchikey("Error"), name("Error"), mol2url("Error"), formula("Error"),
mass(-1.0)
{}
{
Copy link
Member

Choose a reason for hiding this comment

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

These kind of changes seem really weird considering a bunch of other short blocks are consolidated.

If we can get rid of these, I'd appreciate it.

@ghutchis
Copy link
Member

I'll have to look more carefully. Somewhere the #include reordering has broken rendering/avogadrogl.h

// GLEW has to come before gl.h
#include <GL/glew.h>
 
#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif

@ghutchis
Copy link
Member

Otherwise, most of this looks good.

@ghutchis
Copy link
Member

Okay, the gl.h issue is fortunately only in overlayaxes.cpp:

// clang-format off
// This header must come before anything else involving OpenGL
#include <avogadro/rendering/avogadrogl.h>

#include <avogadro/qtopengl/glwidget.h>
// clang-format on

e-kwsm added 2 commits June 26, 2025 05:30
Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
change AllowShortBlocksOnASingleLine to Empty

Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
keep include order and revert sort

Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
unsigned char edgeCaseY = edgeCases[edgeCaseIdxY];

// If the sum is odd, the edge along the y-axis is cut
if ((edgeCase + edgeCaseY) % 2 == 1)
{
if ((edgeCase + edgeCaseY) % 2 == 1) {

Check warning

Code scanning / CodeQL

Bad check for oddness Warning

Possibly invalid test for oddness. This will fail for negative numbers.
unsigned char edgeCaseZ = edgeCases[edgeCaseIdxZ];

// If the sum is odd, the edge along the z-axis is cut
if ((edgeCase + edgeCaseZ) % 2 == 1)
{
if ((edgeCase + edgeCaseZ) % 2 == 1) {

Check warning

Code scanning / CodeQL

Bad check for oddness Warning

Possibly invalid test for oddness. This will fail for negative numbers.
Comment on lines +56 to +59
// #ifdef __cplusplus
// extern "C"
//{
//#endif /* __cplusplus */
// #endif /* __cplusplus */

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Comment on lines +98 to +100
// #ifdef __cplusplus
// } /* extern "C" */
// #endif /* __cplusplus */

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Comment on lines +147 to +152
/*
d->program.detachShader(d->vertexShader);
d->program.detachShader(d->fragmentShader);
d->vertexShader.cleanup();
d->fragmentShader.cleanup();
*/

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Copy link
Contributor

Here are the build results
macOS.dmg
Win64.exe
Artifacts will only be retained for 90 days.

@ghutchis ghutchis merged commit 8e881b0 into OpenChemistry:master Jun 29, 2025
24 of 25 checks passed
Copy link
Contributor

Here are the build results
macOS.dmg
Win64.exe
Artifacts will only be retained for 90 days.

@e-kwsm e-kwsm deleted the clang-format branch June 30, 2025 12:55
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