sierrafoxtrot / srecord

SRecord github Mirror
https://srecord.sourceforge.net/
GNU General Public License v3.0
42 stars 22 forks source link

[WIP] Clang tidy fixes #26

Open jtxa opened 1 year ago

jtxa commented 1 year ago

ATTENTION: this PR is not for a detailed review.

Please have a rough look at each commit (maybe just the first 2-3 changes), which kind of auto-fix makes sense. I will post my conclusion hopefully within a day (I do not have time now).

When we decide on which fixes shall be applied, I will look into every change in detail.

Short summary up-front:

jtxa commented 1 year ago

We should definitely not apply fixes that break the build ;-) But maybe that was caused by manually rebasing it. For this first review the rebase was faster then re-applying with the tool. For the real change I will run the tool again (I have that automated). And check if it builds.

jtxa commented 1 year ago

My wording:

sierrafoxtrot commented 1 year ago

Ok, I didn't realise you were still working on this at the same time as me. I'm trying desperately to avoid doing that, sorry. I'll go back through my list of comments and review your assessment. Please, hold off updating for a few hours to give me a chance to get through it.

sierrafoxtrot commented 1 year ago

I hope this summary list below still lines up with the review comments above. If in doubt, the review comments were written later if that helps).

Summary of responses. The review comments might site specifics etc but the main comments are here: - SF

SF: discuss (or default to no): As mentioned in my review comment, clang-tidy didn't seem consistent in when it triggered on this. In principle, the check itself is ok.

SF: yes (and agree with your approach to the fix)

SF: yes

SF: Yes. Your notes make more sense than the changes clang-tidy provided LOL. Definitely keen for this to be a well written and reviewed fix!

SF: YES!

SF: yes: If these are a consequence of other changes making things static that weren't previously, then lets go with it.

SF: yes

SF: yes (my review comments danced around on this one but seems more in keeping with moving defaults to declarations.

SF: yes

SF: yes (as auto is now being used)

SF: yes

SF: yes

SF: yes

SF: yes (but agree the more meaningful name isn't always the one that has been suggested here. In most cases, the header is better which makes sense, peter always wrote interfaces first almost to completeness and then filled in the implementation.

SF: no, (or perhaps discuss). In some instances the implicity bool makes sense isupper() reads nicely to humans. But boolean checks against zero make me queasy. On balance, no but happy to chat more.

SF: discuss: I like the idea of code review/improve. But I do think the current form is easier to read in terms of intent.

SF: yes

SF: yes (a holdover from earlier times)

SF: yes but agree on the review.

SF: yes

SF: yes. (My current day-job is on medical devices. Can confirm!)

SF: no (my default is to leave it unless there is a benefit.)

SF: no (agreed wholeheartedly with your reasoning)

SF: discuss: Keen to understand the value. I may just be out-of-date on this one.

SF: yes

SF: discuss: Not sure of the benefit here. Declaring without implementing (as already done) has exactly the same effect. I guess this is more explicit; is that th epoint?

SF: yes

SF: yes

SF: Yes (see my comment in the review but really like this

SF: YES!

SF: yes

SF: yes

SF: yes (only because it is the easiest way to get consistency :-) )

SF: yes

SF: no - complexity for no obvious benefit (we aren't shifting megabytes around in any of these). Happy to be convinced otherwise.

SF: yes. If we are going to make some of the other modernize fixes, this one may as well go in.

SF: yes.

SF: yes - but I'm nervous about cutting off folks on older platforms which was litterally the original usecase for SRecord. Chances are this worry is completely unfounded.

My wording:

Adding:

jtxa commented 1 year ago

Update: most messages were fixed in #32

These were agreed to be not fixed:

modernize-pass-by-value
modernize-use-trailing-return-type
modernize-use-using

So these messages are left, which can be autofixed (but may need manual changes or reviews, see comments above)

bugprone-implicit-widening-of-multiplication-result
cppcoreguidelines-init-variables
cppcoreguidelines-pro-type-member-init
modernize-loop-convert
modernize-use-default-member-init
modernize-use-equals-default
modernize-use-equals-delete
modernize-use-nullptr
modernize-use-override
readability-braces-around-statements
readability-convert-member-functions-to-static
readability-else-after-return
readability-implicit-bool-conversion
readability-inconsistent-declaration-parameter-name
readability-redundant-member-init
readability-redundant-string-init

For the current state of unfixed messages see .clang-tidy which also contains other warnings which may need to be discussed and manually fixed.