Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[496 Battery module incorrectly trims whitespace] #515

Closed
wants to merge 1 commit into from
Closed

[496 Battery module incorrectly trims whitespace] #515

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Sep 8, 2023

#496

  • Added dependencies for arch-based systems in the README.md;
  • Removed the trim functions in the output.c, it was only used by print_battery_info (dead code);
  • Removed the forced trimming in print_battery_info;
  • Modifed the expected output of the 014 test. There is an space between
    the two last %parameters, the expected output must reflect this space
    character;
  • print_eth_info and print_wireless_info got modifed by running
    clang-format -i **/*.[ch] (clang-format version 16.0.3) as specified
    in the CONTRIBUTING.md file;

Note:
I believe the initial intent of the trimming was to remove spaces due
to empty values such as in this example: %remaining having no value
when the battery is at 100%.

It creates a tailing space, which was in the formatting, made by the user,
to separate the last two parameters.

format: ... %status %remaining
result: ... [status value][space][empty string here due to no value]

Although, even with the trimming, an empty value right in the middle of
a set of %parameters will still make empty spaces.

I tested the claim other modules not trimning and it was the true. In
other words, the trimming did not fix anything and it was causing this
module to behave abnormally.

+ Added dependencies for arch-based systems in the README.md;
- Removed the trim functions in the output.c, it was only used by
  print_battery_info (dead code);
- Removed the forced trimming in print_battery_info;
= Modifed the expected output of the 014 test. There is an space between
  the two last %parameters, the expected output must reflect this space
  character;
= print_eth_info and print_wireless_info got modifed by running
  clang-format -i **/*.[ch] (clang-format version 16.0.3) as specified
  in the CONTRIBUTING.md file;

Note:
  I believe the initial intent of the trimming was to remove spaces due
  to empty values such as in this example: %remaining having no value
  when the battery is at 100%.

  It creates a tailing space, which was in the formatting, made by the user,
  to separate the last two parameters.

  format: ... %status %remaining
  result: ... [status value][space][empty string here due to no value]

  Although, even with the trimming, an empty value right in the middle of
  a set of %parameters will still make empty spaces.

  I tested the claim other modules not trimning and it was the true. In
  other words, the trimming did not fix anything and it was causing this
  module to behave abnormally.
Repository owner closed this by deleting the head repository Dec 26, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant