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

Chore : Code Coverage, Code Simplify #5

Merged
merged 2 commits into from
Aug 28, 2021
Merged

Chore : Code Coverage, Code Simplify #5

merged 2 commits into from
Aug 28, 2021

Conversation

yezz123
Copy link
Collaborator

@yezz123 yezz123 commented Aug 28, 2021

Code Coverage, Code Simplify 🚀

  • Hello @Abdenasser 👋, I'm happy to contribute to your project, by Opening This Pull Request.
  • I see that We can Minify the code and make it more readable, by reducing Code Specification and Use the pep8 code requirements for The Coverage.

Overview

  • I will try to show the Function that I edited in the code and the code that I added to the code.

Function Generator.get_fields_string

  • Simplify generator expression.

An identity generator (a for a in coll) can be replaced directly with the collection coll.

Function is_present_in_file

  • Simplify conditional into return statement

Explanation

  • The expression (a for a in b) is a generator that returns all of the elements of b. If being passed into a function like any or all that takes a generator or sequence, it can simply be replaced by b which is much clearer.

Test Cases

  • in the tests folder, i find in the most of Test Cases Functions this little Style issue Simplify generator expression , and i try to simplify them.

  • Function TestGenerator.test_run , Instead, create a new class and place the fields and methods responsible for the relevant functionality in it.

  • Function TestGenerator.test_generate_models , here you can Extract duplicate code into method.

One of the main ways to remove duplication is to extract the common areas into another method and call that.

Copy link
Collaborator Author

@yezz123 yezz123 left a comment

Choose a reason for hiding this comment

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

I Guess, Extract duplicate code into the method is not achievable by the Test. #5 #6

generator_obj.api_dir = self.api_folder
result = generator_obj.run()
assert result == print("🎉 Your RESTful Article api resource is ready 🎉")
result = self._extracted_from_test_run_6(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unused variable (Relate to build Failed) #6 #5

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I Just revert test_run to the old version. 48bf7ca

generator_obj.core_dir = self.core_folder
generator_obj.api_dir = self.api_folder
generator_obj.generate_models()
generator_obj = self._extracted_from_test_generate_models_3()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unused variable 'generator_obj' #6 #5

@yezz123 yezz123 changed the title chore : Code Coverage, Code Simplify Chore : Code Coverage, Code Simplify Aug 28, 2021
@codecov
Copy link

codecov bot commented Aug 28, 2021

Codecov Report

Merging #5 (48bf7ca) into main (29692a9) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main       #5      +/-   ##
==========================================
- Coverage   97.58%   97.55%   -0.03%     
==========================================
  Files           9        9              
  Lines         248      245       -3     
==========================================
- Hits          242      239       -3     
  Misses          6        6              
Impacted Files Coverage Δ
dr_scaffold/file_api.py 100.00% <100.00%> (ø)
dr_scaffold/generators.py 95.94% <100.00%> (-0.03%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29692a9...48bf7ca. Read the comment docs.

Copy link
Owner

@Abdenasser Abdenasser left a comment

Choose a reason for hiding this comment

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

@yezz123 LGTM, thanks a lot 👍🏻

@Abdenasser Abdenasser merged commit 99ef90a into Abdenasser:main Aug 28, 2021
@yezz123 yezz123 deleted the Coverage branch August 28, 2021 10:16
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

2 participants