ShahriyarR / MySQL-AutoXtraBackup

MySQL-AutoXtraBackup commandline tool written in Python 3 based on Percona XtraBackup
https://autoxtrabackup.azepug.az/
MIT License
139 stars 79 forks source link

Increasing code coverage by adding extra unit tests #444

Closed ShahriyarR closed 3 years ago

ShahriyarR commented 3 years ago

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

sourcery-ai[bot] commented 3 years ago

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:

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.