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

Don't write defaultFormat setting, use default value #10732

Merged
merged 1 commit into from Mar 25, 2024

Conversation

Profpatsch
Copy link
Contributor

Nowhere else does this (write a setting if it’s not set).

It took me a while to see that this code does not do what it intends, because defaultFormat is already the default value in the first context.getString, so calling getMediaFormatFromKey again is the exact same call (“do you know the definition of insanity…”) and will return null again …

So let’s drop the setting write and just rely on the default values.

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Due diligence

Nowhere else does this (write a setting if it’s not set).

It took me a while to see that this code does not do what it intends,
because `defaultFormat` is already the default value in the first
`context.getString`, so calling `getMediaFormatFromKey` again is the
exact same call (“do you know the definition of insanity…”) and will
return `null` again …

So let’s drop the setting write and just rely on the default values.
Copy link

sonarcloud bot commented Jan 6, 2024

Copy link
Member

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

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

Thanks. LGTM
Can you add tests for this method into ListHelperTest?

@TobiGr TobiGr added bug Issue is related to a bug codequality Improvements to the codebase to improve the code quality labels Mar 18, 2024
@Profpatsch
Copy link
Contributor Author

It’s a 2 line straight-forward function, what good would a test do?

@TobiGr TobiGr merged commit 5cf3c58 into TeamNewPipe:dev Mar 25, 2024
6 of 9 checks passed
@Stypox Stypox mentioned this pull request Apr 1, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug codequality Improvements to the codebase to improve the code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants