Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Increasing code coverage by adding extra unit tests #444

Merged
merged 3 commits into from
May 6, 2021

Conversation

ShahriyarR
Copy link
Owner

As you add tests, further you are doing code changes as well, to make it more testable.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented May 6, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 1.45%.

Quality metrics Before After Change
Complexity 4.80 ⭐ 4.47 ⭐ -0.33 👍
Method Length 61.74 🙂 57.72 ⭐ -4.02 👍
Working memory 9.81 🙂 9.44 🙂 -0.37 👍
Quality 67.19% 🙂 68.64% 🙂 1.45% 👍
Other metrics Before After Change
Lines 753 804 51
Changed files Quality Before Quality After Quality Change
mysql_autoxtrabackup/backup_backup/backup_builder.py 59.35% 🙂 59.35% 🙂 0.00%
mysql_autoxtrabackup/backup_backup/backuper.py 63.03% 🙂 62.43% 🙂 -0.60% 👎
mysql_autoxtrabackup/utils/helpers.py 81.95% ⭐ 81.06% ⭐ -0.89% 👎
tests/conftest.py 100.00% ⭐ 98.67% ⭐ -1.33% 👎
tests/test_backup.py 89.99% ⭐ 85.19% ⭐ -4.80% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
mysql_autoxtrabackup/backup_backup/backuper.py Backup.all_backup 16 🙂 165 😞 12 😞 42.90% 😞 Try splitting into smaller methods. Extract out complex expressions
mysql_autoxtrabackup/backup_backup/backup_builder.py BackupBuilderChecker.extract_decrypt_from_stream_backup 9 🙂 155 😞 16 ⛔ 44.62% 😞 Try splitting into smaller methods. Extract out complex expressions
mysql_autoxtrabackup/backup_backup/backup_builder.py BackupBuilderChecker.general_command_builder 12 🙂 199 😞 8 🙂 51.24% 🙂 Try splitting into smaller methods
mysql_autoxtrabackup/backup_backup/backup_builder.py BackupBuilderChecker.decrypter 6 ⭐ 140 😞 12 😞 54.44% 🙂 Try splitting into smaller methods. Extract out complex expressions
mysql_autoxtrabackup/backup_backup/backuper.py Backup.show_tags 3 ⭐ 99 🙂 19 ⛔ 54.53% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

@ShahriyarR ShahriyarR merged commit f54384e into release_v2.0.2 May 6, 2021
ShahriyarR added a commit that referenced this pull request May 6, 2021
* Increasing code coverage by adding extra unit tests (#444)

* First batch of tests

* Added API tests, continued on file based tests

* Got 50% test coverage - needs to be addressed further

* update for README.md

* Formatting with black and version bump

* Passing the mypy check

* extra linting, formatting
@ShahriyarR ShahriyarR deleted the issue443 branch May 6, 2021 12:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant