Skip to content

Conversation

jcfr
Copy link
Contributor

@jcfr jcfr commented Aug 25, 2025

This pull request improve the runastyle scripts for easier use:

  • Ensure the scripts can be executed from any location.
  • Centralize astyle configuration with a .astylerc file.
  • Require astyle 3.4.13 (also available on PyPI) to preserve current formatting; newer 3.6.9 alters continuation-line indentation.
  • Add support for command runners like pipx and uvx if astyle is not available in the PATH.
  • Simplify the batch script with "@echo off" and proper error handling.
  • Combine astyle invocations for .h and .cpp files into a single command.
  • Format source files according to the updated style guidelines.

jcfr added 9 commits August 25, 2025 19:23
This change updates the runastyle scripts to set the working directory to the
script's directory, ensuring consistent behavior regardless of the initial
execution location.
This change introduces a `.astylerc` configuration file to centralize and
simplify the astyle settings for both the runastyle script and IDE integration.
This change applies code formatting to the source files using astyle version
3.0.1 according to the project's style guidelines.
This refactor introduces a dedicated `ASTYLE_VERSION` variable (formatted as
`X.Y.Z`) and derives `ASTYLE_VERSION_STR` automatically. This separation makes
it clearer where to update the required version and ensures consistency across
platforms.

The change simplifies maintenance and prepares the scripts for use with command
runners such as `pipx` or `uvx`.
This change simplifies the Windows batch script by using "@echo OFF" to
reduce unnecessary output, making the script cleaner and easier to read.
This change adds the missing `EXIT_ERROR` label to the `runastyle.bat` script,
ensuring proper error handling and exit status.
- Bump required astyle from 3.0.1 to 3.4.13 to enable easy installs via
  pipx/uvx from PyPI.
- Keep formatting stable: 3.4.13 matches our current output, whereas 3.6.9
  changes continuation-line indentation (e.g., after &&).
- Use `--project` (available since 3.2) instead of `--options` to simplify
  config discovery.

No formatting diffs expected with the current `.astylerc`
This change improves the runastyle scripts to support multiple ways of invoking
astyle.
This change simplifies the runastyle script by combining the invocation
of the astyle executable for both .h and .cpp files into a single command.
@jcfr
Copy link
Contributor Author

jcfr commented Aug 25, 2025

While working on finalizing #448, I realized that astyle integration could be further improved to simplify the developer experience.

Once this is integrated, I suggest we also introduce a workflow running astyle

@firewave
Copy link
Collaborator

Cppcheck has moved to uncrustify quite a while ago, so simplecpp should probably do the same.

@jcfr
Copy link
Contributor Author

jcfr commented Aug 26, 2025

Thanks for the review.

so simplecpp should probably do the same.

Given limited bandwidth, I will not be able to switch to uncrustify. In the meantime, I think moving forward with this may be sensible as it allow contributor to apply the formatting.

@firewave
Copy link
Collaborator

I leave that up to @danmar.

@jcfr
Copy link
Contributor Author

jcfr commented Aug 26, 2025

Thanks for the taking the time to review 🙏

While I understand we could switch to uncrustify or clang-format, I think this is a sensible improvement to streamline contributions. The use of alternative formatters or linters could definitely be done in follow-up pull requests.

Once the GitHub workflow have been enabled and the test pass, I believe this will be ready for integration 🚀

cc: @danmar @firewave

@danmar
Copy link
Owner

danmar commented Aug 28, 2025

Thank you for this contribution but I fear that I feel we should switch to uncrustify instead asap. If you don't have the bandwidth I understand. But we more or less just need to copy the runformat script from the cppcheck repo and reuse all the options..

@danmar danmar closed this Aug 28, 2025
@jcfr
Copy link
Contributor Author

jcfr commented Aug 28, 2025

Thanks for the feedback. I agree that moving to uncrustify makes sense long-term, and I understand the idea of reusing the runformat script from the cppcheck repo.

In the meantime, I believe these small changes still help streamline the contribution process for new contributors. To keep things clear and incremental, I’ll follow up with two pull requests:

  • One with this commit: da16a44d (style: Format sources using astyle 3.0.1)
  • One removing all remaining references to astyle, since the current instructions are outdated and misleading.

This way the repo stays consistent and contributors won’t be confused by stale formatting instructions while the switch to uncrustify is being worked out.

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