Giter VIP home page Giter VIP logo

Comments (12)

glitchcore avatar glitchcore commented on July 28, 2024

(from #39) At this time I prefer default rustfmt settings as code style (https://rust-lang.github.io/rustfmt/?version=master&search=) even in C/C++ code (where applicable, of course)

I suggest adapt rustfmt defaults to clang format

from flipperzero-firmware.

glitchcore avatar glitchcore commented on July 28, 2024

@officialdarksheao can I assign you to this task?

from flipperzero-firmware.

glitchcore avatar glitchcore commented on July 28, 2024

We have a lot of thirdparty SDK code in target_f* folders now, I don't like its style and maybe we should ignore it

from flipperzero-firmware.

glitchcore avatar glitchcore commented on July 28, 2024

@nikita-b can I assign you to this task?

from flipperzero-firmware.

nikita-b avatar nikita-b commented on July 28, 2024

@glitchcore Yes, sure

from flipperzero-firmware.

glitchcore avatar glitchcore commented on July 28, 2024

@nikita-b Do you still want to do this task?

from flipperzero-firmware.

pavel-demin avatar pavel-demin commented on July 28, 2024

CI pipeline to prevent merge of pull requests if the style check was not successful

Here's an example of an action that executes clang-format on each push. If the code changes after formatting, this action creates an additional commit with a fixed commit message ("apply clang-format").

What do you think about this approach?

from flipperzero-firmware.

nikita-b avatar nikita-b commented on July 28, 2024

@glitchcore Yes, sorry for the delay. I'll start today.

from flipperzero-firmware.

reendael avatar reendael commented on July 28, 2024

CI pipeline to prevent merge of pull requests if the style check was not successful

Here's an example of an action that executes clang-format on each push. If the code changes after formatting, this action creates an additional commit with a fixed commit message ("apply clang-format").

What do you think about this approach?

Wouldn't it be better if a pre-commit hook ran clang-format check, detected if the output differed from the input file and notified the developer with a warning and a hint to run clang-format manually?

This way developers are encouraged to periodically (or automatically) run clang-format themselves and even more importantly, will prevent pollution of git history with formatting commits.

from flipperzero-firmware.

pavel-demin avatar pavel-demin commented on July 28, 2024

Wouldn't it be better if a pre-commit hook ran clang-format check, detected if the output differed from the input file and notified the developer with a warning and a hint to run clang-format manually?

Since the pre-commit hooks run locally on the developer's machine, and the clang-format parameters change from version to version, we'll need to make sure that all developers have the same clang-format version.

from flipperzero-firmware.

pavel-demin avatar pavel-demin commented on July 28, 2024

Formatting errors can be detected with the following command:

clang-format --dry-run --Werror --ferror-limit=1 <file>

from flipperzero-firmware.

nikita-b avatar nikita-b commented on July 28, 2024

CI pipeline to prevent merge of pull requests if the style check was not successful

Here's an example of an action that executes clang-format on each push. If the code changes after formatting, this action creates an additional commit with a fixed commit message ("apply clang-format").
What do you think about this approach?

Wouldn't it be better if a pre-commit hook ran clang-format check, detected if the output differed from the input file and notified the developer with a warning and a hint to run clang-format manually?

This way developers are encouraged to periodically (or automatically) run clang-format themselves and even more importantly, will prevent pollution of git history with formatting commits.

Pre-commit hook is a great idea, but I think it'll be more complicated for contributors with the Windows machine and new contributors. I suggest starting with CI and git history won't be a problem if we squash commits before a merge.

from flipperzero-firmware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.