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

feat: #233 - new class OpenFoodFactsCountry, clearer than "cc" #292

Merged
merged 2 commits into from Nov 19, 2021

Conversation

monsieurtanuki
Copy link
Contributor

New file:

  • CountryHelper.dart: country enums and their ISO-2-codes

Impacted files:

  • AbstractQueryConfiguration.dart: deprecated String? cc in favor of OpenFoodFactsCountry? country
  • api_getTaxonomy_test.dart: now using OpenFoodAPIConfiguration.globalCountry
  • api_getTaxonomyAdditives_test.dart: now using OpenFoodAPIConfiguration.globalCountry
  • api_getTaxonomyAllergens_test.dart: now using OpenFoodAPIConfiguration.globalCountry
  • api_getTaxonomyCategories_test.dart: now using OpenFoodAPIConfiguration.globalCountry
  • api_getTaxonomyCountries_test.dart: now using OpenFoodAPIConfiguration.globalCountry
  • api_getTaxonomyIngredients_test.dart: now using OpenFoodAPIConfiguration.globalCountry
  • api_getTaxonomyLabels_test.dart: now using OpenFoodAPIConfiguration.globalCountry
  • api_getTaxonomyLanguages_test.dart: now using OpenFoodAPIConfiguration.globalCountry
  • OpenFoodAPIConfiguration.dart: deprecated String? globalCC in favor of OpenFoodFactsCountry? globalCountry
  • openfoodfacts.dart: minor refactoring
  • ProductListQueryConfiguration.dart: added parameter OpenFoodFactsCountry? country
  • ProductQueryConfigurations.dart: added parameter OpenFoodFactsCountry? country
  • ProductSearchQueryConfiguration.dart: added parameter OpenFoodFactsCountry? country
  • TaxonomyAdditive.dart: added parameter OpenFoodFactsCountry? country
  • TaxonomyAllergen.dart: added parameter OpenFoodFactsCountry? country
  • TaxonomyCategory.dart: added parameter OpenFoodFactsCountry? country
  • TaxonomyCountry.dart: added parameter OpenFoodFactsCountry? country
  • TaxonomyIngredient.dart: added parameter OpenFoodFactsCountry? country
  • TaxonomyLabel.dart: added parameter OpenFoodFactsCountry? country
  • TaxonomyLanguage.dart: added parameter OpenFoodFactsCountry? country
  • TaxonomyQueryConfiguration.dart: deprecated String? cc in favor of OpenFoodFactsCountry? country

…n "cc"

New file:
* `CountryHelper.dart`: country enums and their ISO-2-codes

Impacted files:
* `AbstractQueryConfiguration.dart`: deprecated `String? cc` in favor of `OpenFoodFactsCountry? country`
* `api_getTaxonomy_test.dart`: now using `OpenFoodAPIConfiguration.globalCountry`
* `api_getTaxonomyAdditives_test.dart`: now using `OpenFoodAPIConfiguration.globalCountry`
* `api_getTaxonomyAllergens_test.dart`: now using `OpenFoodAPIConfiguration.globalCountry`
* `api_getTaxonomyCategories_test.dart`: now using `OpenFoodAPIConfiguration.globalCountry`
* `api_getTaxonomyCountries_test.dart`: now using `OpenFoodAPIConfiguration.globalCountry`
* `api_getTaxonomyIngredients_test.dart`: now using `OpenFoodAPIConfiguration.globalCountry`
* `api_getTaxonomyLabels_test.dart`: now using `OpenFoodAPIConfiguration.globalCountry`
* `api_getTaxonomyLanguages_test.dart`: now using `OpenFoodAPIConfiguration.globalCountry`
* `OpenFoodAPIConfiguration.dart`: deprecated `String? globalCC` in favor of `OpenFoodFactsCountry? globalCountry`
* `openfoodfacts.dart`: minor refactoring
* `ProductListQueryConfiguration.dart`: added parameter `OpenFoodFactsCountry? country`
* `ProductQueryConfigurations.dart`: added parameter `OpenFoodFactsCountry? country`
* `ProductSearchQueryConfiguration.dart`: added parameter `OpenFoodFactsCountry? country`
* `TaxonomyAdditive.dart`: added parameter `OpenFoodFactsCountry? country`
* `TaxonomyAllergen.dart`: added parameter `OpenFoodFactsCountry? country`
* `TaxonomyCategory.dart`: added parameter `OpenFoodFactsCountry? country`
* `TaxonomyCountry.dart`: added parameter `OpenFoodFactsCountry? country`
* `TaxonomyIngredient.dart`: added parameter `OpenFoodFactsCountry? country`
* `TaxonomyLabel.dart`: added parameter `OpenFoodFactsCountry? country`
* `TaxonomyLanguage.dart`: added parameter `OpenFoodFactsCountry? country`
* `TaxonomyQueryConfiguration.dart`: deprecated `String? cc` in favor of `OpenFoodFactsCountry? country`
@M123-dev
Copy link
Member

M123-dev commented Nov 15, 2021

What I read from the code yet looks good, but what about deprecating all the other cc fields keeping them long term clutters the source code. Also with "replace all" it shouldn't take that much time

Impacted files:
* `api_getProduct_test.dart`: not using deprecated parameter `lc` anymore
* `ProductListQueryConfiguration.dart`: deprecated parameters `lc` and `cc`
* `ProductQueryConfigurations.dart`: deprecated parameters `lc` and `cc`
* `ProductSearchQueryConfiguration.dart`: deprecated parameters `lc` and `cc`
* `TaxonomyAdditive.dart`: deprecated parameter cc`
* `TaxonomyAllergen.dart`: deprecated parameter cc`
* `TaxonomyCategory.dart`: deprecated parameter cc`
* `TaxonomyCountry.dart`: deprecated parameter cc`
* `TaxonomyIngredient.dart`: deprecated parameter cc`
* `TaxonomyLabel.dart`: deprecated parameter cc`
* `TaxonomyLanguage.dart`: deprecated parameter cc`
@monsieurtanuki
Copy link
Contributor Author

@M123-dev That's similar to what happened with languages.
Not sure if my latest commit goes in your direction: I deprecated lc and cc in the subclasses too. Perhaps you meant that we should be rid of those fields instead. "decluttering" at a different level.

Copy link
Collaborator

@peterwvj peterwvj left a comment

Choose a reason for hiding this comment

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

Looks good, thanks. Consider removing the code comments in CountryHelper.dart. The enum values are self explanatory, e.g.

...
  /// Congo
  CONGO,
...

Copy link
Member

@M123-dev M123-dev left a comment

Choose a reason for hiding this comment

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

Ohh, I wasn't quite paying attention there. Maybe reviewing pull request after schoolwork is done would help. I thought we would pass cc to each function in OpenFoodAPIClient.

Anyway the code looks great, thanks for this enormous PR

@monsieurtanuki
Copy link
Contributor Author

Looks good, thanks. Consider removing the code comments in CountryHelper.dart. The enum values are self explanatory, e.g.

...
  /// Congo
  CONGO,
...

@peterwvj The point of those comments is not to be very interesting, it's just that each enum is supposed to be commented, if not the pub.dev score may go down.

@monsieurtanuki
Copy link
Contributor Author

@peterwvj By the way your example ("Congo") was not very lucky as there are two countries named "Congo". That's precisely where a comment would have helped ;)

@M123-dev OK to merge now or are there other actions we are waiting for?

@M123-dev
Copy link
Member

Yes of course we can merge.

On Wednesday the automated release didn't worked because we had to publish once to extract the authentication credentials since this is a reasonable PR for a own release its fits perfectly.

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

3 participants