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

Format DrumSynth #7189

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

Monospace-V
Copy link
Contributor

This file is so old I am making a separate pull request for it instead of grouping its cleaning with the rest of my categories.
Several issues here.
Bad formatting includes poor space usage (no space around operators / flow control), bad nextline usage and bad indentation (two space indentation instead of tab).

Additionally there is ugly logic (nested if loops).

I will fix as much of the formatting as I can myself. I cannot speak for the rest.
Hopefully the next person approaching this file will have at least a better formatted task ahead of them.

@Monospace-V
Copy link
Contributor Author

someone will want to run through this and check space usage where typecasting is done, and maybe glance through conventions?

Copy link
Contributor

@Rossmaxx Rossmaxx left a comment

Choose a reason for hiding this comment

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

Some initial thoughts i got from the diff. Try solving these. I haven't included all of it.

src/core/DrumSynth.cpp Outdated Show resolved Hide resolved
src/core/DrumSynth.cpp Outdated Show resolved Hide resolved
src/core/DrumSynth.cpp Outdated Show resolved Hide resolved
src/core/DrumSynth.cpp Outdated Show resolved Hide resolved
src/core/DrumSynth.cpp Outdated Show resolved Hide resolved
src/core/DrumSynth.cpp Outdated Show resolved Hide resolved
@sakertooth
Copy link
Contributor

You know, it would've taken zero effort to format the entire document if you wanted to satisfy our formatting conventions.

@Monospace-V
Copy link
Contributor Author

You know, it would've taken zero effort to format the entire document if you wanted to satisfy our formatting conventions.

Unfortunately, I am stupid.

@Monospace-V
Copy link
Contributor Author

You know, it would've taken zero effort to format the entire document if you wanted to satisfy our formatting conventions.

It is too late now. I have put in non-zero effort which cannot be backspaced. I shall continue to do so. But would be kinda useful if you could tell me more about this

@sakertooth
Copy link
Contributor

sakertooth commented Apr 2, 2024

It is too late now. I have put in non-zero effort which cannot be backspaced. I shall continue to do so. But would be kinda useful if you could tell me more about this

There are probably other ways, but using VSCode with our .clang-tidy (.clang-format) file allows you to format the entire document based on what is specified there. I can push a commit to format everything here for you if you want.

@Monospace-V
Copy link
Contributor Author

There are probably other ways, but using VSCode with our .clang-tidy file allows you to format the entire document based on what is specified there. I can push a commit to format everything here for you if you want.

Ah. The weird stuff I don't understand. I keep forgetting it exists
Dunno enough. If you think that would be a sensible idea, sure go right ahead
At this point, if it does that, why don't we do everything with that instead?

@sakertooth
Copy link
Contributor

At this point, if it does that, why don't we do everything with that instead?

Usually, we don't do this because there are a lot of out of scope changes it create when making PRs. But since this is a formatting PR, all the changes in here would be relevant and in scope.

@sakertooth sakertooth changed the title Try to clean src/core/DrumSynth.cpp Format src/core/DrumSynth.cpp Apr 2, 2024
@sakertooth sakertooth marked this pull request as ready for review April 2, 2024 18:17
@Monospace-V
Copy link
Contributor Author

Usually, we don't do this because there are a lot of out of scope changes it create when making PRs. But since this is a formatting PR, all the changes in here would be relevant and in scope.

Wait. All those PRs I plan to do to clean and there's a command I could do that just wasn't being done?
Can you (on discord maybe) just help me understand how it's done. Is it an option to go through and format a lot of files with this so everything's up to format?

@Monospace-V
Copy link
Contributor Author

Monospace-V commented Apr 3, 2024

I notice that some of the block brace work has been deleted, among other things. Your commit would mostly format whitespaces and ordering.
image
image
@sakertooth should I redo some of that work on this directly, or would you run that command on my last commit with that stuff done?
In the future I'll probably want to run that first and then go on with looking through.

@sakertooth sakertooth changed the title Format src/core/DrumSynth.cpp Format DrumSynth Apr 3, 2024
@sakertooth
Copy link
Contributor

Let me know if there's anything else that should be done here 👍.

@Monospace-V
Copy link
Contributor Author

It looks about right at first glance. I will check it from PC at a later point. Thank you.
Can you at some point explain to me what you did and direct me to the applicable documentation for the same?

@sakertooth
Copy link
Contributor

Can you at some point explain to me what you did and direct me to the applicable documentation for the same?

Our .clang-tidy and .clang-format files pretty much make up what was done here (though the transition to use the named casts instead of C-style casts was done manually). You can take a look there for some ideas. Here are some details on clang-tidy and clang-format.

@Monospace-V
Copy link
Contributor Author

Screenshot_20240406-100307.jpg

I notice you have moved the asterisks. I was under the impression that char *key and char* key meant different things, but I believe you know what you are doing. I just want to bring this to your attention to confirm.

Additionally I perceive some confusing nextline usage/requirement I will probably want to resolve. I will not be at my home computer for about two or three days, so unlikely to do it till then. I will try to see if I can do something about it anyway.

I am under the understanding this pull request still be marked as ready for review due to your tendency to keep it that way.

@Veratil
Copy link
Contributor

Veratil commented Apr 6, 2024

I was under the impression that char *key and char* key meant different things

They actually are the same in this context. This confusion is why we put the pointer with the type instead of with the variable name.

@sakertooth
Copy link
Contributor

Additionally I perceive some confusing nextline usage/requirement I will probably want to resolve. I will not be at my home computer for about two or three days, so unlikely to do it till then. I will try to see if I can do something about it anyway.

Feel free to do anything remaining that you think fits with our conventions, I just wanted to help you out a bit since it seemed like you were facing some difficulty with this file. 👍

@Monospace-V Monospace-V marked this pull request as draft April 9, 2024 03:03
Requesting this to be looked at since am unsure of indentation
Additionally view if/else blocks, see if convertable to else-if anywhere
@Monospace-V Monospace-V marked this pull request as ready for review April 9, 2024 09:37
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.

None yet

4 participants