Skip to content

Conversation

@FrankBakkerNl
Copy link
Contributor

@FrankBakkerNl FrankBakkerNl commented Dec 17, 2022

Fix #728 where extension methods were generated for typed entity classes that do not exist because the user has no entities for them

Breaking change

Proposed change

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the [development checklist][dev-checklist]
  • The code compiles without warnings (code quality chek)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

…ntity classes that do not exist because the user has no entities for them
@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2022

Codecov Report

Base: 77.86% // Head: 77.84% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (75d3e86) compared to base (c08e9da).
Patch coverage: 88.88% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #813      +/-   ##
==========================================
- Coverage   77.86%   77.84%   -0.02%     
==========================================
  Files         158      158              
  Lines        4142     4134       -8     
  Branches      419      419              
==========================================
- Hits         3225     3218       -7     
  Misses        753      753              
+ Partials      164      163       -1     
Flag Coverage Δ
unittests 77.84% <88.88%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...Model.CodeGenerator/Helpers/SyntaxFactoryHelper.cs 94.44% <ø> (-0.23%) ⬇️
...erator/CodeGeneration/ExtensionMethodsGenerator.cs 97.10% <86.66%> (+1.15%) ⬆️
...aemon.HassModel.CodeGenerator/Model/HassService.cs 100.00% <100.00%> (ø)
...HassModel.CodeGenerator/Model/HassServiceDomain.cs 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.


code.ToString().Should().NotContain("humidifiers", because:"There is no entity for domain humidifiers");
code.ToString().Should().NotContain("DumbthingsEntityExtensionMethods", because:"There is no entity for any of the services in dumbthings");

Choose a reason for hiding this comment

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

I think this test should be split into two tests. One to test that methods are only created when the target domain has entities (the "smart_things" service domain here) and a second to test that empty extension method classes aren't created for service domains that don't have any eligible methods (the "dumbthings" service domain here). But, this is pedantic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this does make it more clear, split them up

Copy link
Collaborator

@helto4real helto4real left a comment

Choose a reason for hiding this comment

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

Nice one. Good job!

@FrankBakkerNl FrankBakkerNl merged commit 1bd5bc6 into net-daemon:dev Dec 22, 2022
@FrankBakkerNl FrankBakkerNl deleted the fix_728_SkipExtensionMethodForNonExisitingEntitytype branch December 23, 2022 15:06
Ikcelaks pushed a commit to Ikcelaks/netdaemon that referenced this pull request Dec 23, 2022
…ntity clas… (net-daemon#813)

* Fix net-daemon#728 where extension methods were generated for typed entity classes that do not exist because the user has no entities for them

* split test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing strong typed Entity in generated code

4 participants