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

fix log message format error, some refactoring #424

Closed Turall closed 3 years ago

Turall commented 3 years ago

in some places in the code, the format of the log messages was not correct. In the future, this would lead to errors. PEP conditions were not observed. All of this has been fixed, not entirely, but most of it

sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.13%.

Quality metrics Before After Change
Complexity 63.91 ⛔ 64.82 ⛔ 0.91 👎
Method Length 108.60 🙂 107.87 🙂 -0.73 👍
Working memory 17.36 ⛔ 17.46 ⛔ 0.10 👎
Quality 40.88% 😞 40.75% 😞 -0.13% 👎
Other metrics Before After Change
Lines 3261 3491 230
Changed files Quality Before Quality After Quality Change
autoxtrabackup.py 25.18% 😞 24.77% ⛔ -0.41% 👎
backup_prepare/prepare.py 19.92% ⛔ 19.84% ⛔ -0.08% 👎
general_conf/check_env.py 74.46% 🙂 73.43% 🙂 -1.03% 👎
master_backup_script/backuper.py 38.38% 😞 38.40% 😞 0.02% 👍
partial_recovery/partial.py 60.89% 🙂 63.40% 🙂 2.51% 👍
prepare_env_test_mode/clone_build_start_server.py 66.21% 🙂 66.21% 🙂 0.00%
prepare_env_test_mode/take_backup.py 41.86% 😞 41.89% 😞 0.03% 👍
prepare_env_test_mode/test_check_env.py 81.71% ⭐ 81.71% ⭐ 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
autoxtrabackup.py all_procedure 89 ⛔ 871 ⛔ 73 ⛔ 0.33% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
backup_prepare/prepare.py Prepare.prepare_with_tags 295 ⛔ 1063 ⛔ 25 ⛔ 1.92% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
backup_prepare/prepare.py Prepare.prepare_inc_full_backups 182 ⛔ 615 ⛔ 23 ⛔ 2.77% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
master_backup_script/backuper.py Backup.inc_backup 88 ⛔ 767 ⛔ 23 ⛔ 2.98% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
backup_prepare/prepare.py Prepare.prepare_only_full_backup 152 ⛔ 753 ⛔ 21 ⛔ 3.59% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. 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.