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

Fixed the deprecate method compiler warnings for the JSON parsing for MQTT messages #91

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

Martinius79
Copy link
Collaborator

Fixed the deprecate method compiler warnings for the JSON parsing for MQTT messages.

containskey() method from ArduinoJSON is marked as deprecated and is now replaced in the code.

Tested with (and without) Home Assistant integration active.

See: https://arduinojson.org/v7/api/jsondocument/containskey/

@eku
Copy link

eku commented Oct 27, 2024

May I suggest that you please only make changes to the content and leave the formatting as it is?

@Martinius79
Copy link
Collaborator Author

Martinius79 commented Oct 28, 2024

Hello eku!

By "formatting as it is," I assume you mean the seven new lines and the two changed indentations you mentioned previously.

I removed those changes with the last commit.

The best way to avoid formatting inconsistencies is indeed by using a defined formatting rule set. Visual Studio Code's C/C++ extension already offers this functionality with default settings based on the Clang formatter.

By pressing Alt+Shift+F (or the equivalent shortcut on your system) on the current document in VS Code, it will be formatted according to the defined default rule set.

I've demonstrated this with the actual C++ source code in the following branch as an example:
https://github.com/Martinius79/EleksTubeHAX/tree/mainCLangFormatted

While the default formatting might not be perfect for everyone's taste, it would be a good idea for all contributors to use the "format document" method on changed files. This would ensure a consistent codebase as a common starting point.

Bye
Martinius

@aly-fly
Copy link
Owner

aly-fly commented Oct 31, 2024

One conflict is here. Please check and resolve.

@Martinius79
Copy link
Collaborator Author

Done

@aly-fly aly-fly merged commit c3cd947 into aly-fly:main Nov 1, 2024
2 checks passed
@eku
Copy link

eku commented Nov 2, 2024

The best way to avoid formatting inconsistencies is indeed by using a defined formatting rule set.

If there are no explicit rules, then format the code like the existing one. Turn off all the magic of the IDE.

Well, at least configure your IDE to only format changed lines and leave the rest as is. VIM suports it :)

@Martinius79 Martinius79 deleted the FixCompilerWarningsJSONParsing branch November 3, 2024 18:23
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