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

Sourcery refactored main branch #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Mar 27, 2023

Branch main refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch origin sourcery/main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from neoclust March 27, 2023 21:05
Copy link
Author

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Due to GitHub API limits, only the first 60 comments can be shown.

Comment on lines -35 to +37
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=main&action=default")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=main&action=default"
)
Copy link
Author

Choose a reason for hiding this comment

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

Function medulla_connect refactored with the following changes:

Comment on lines -22 to +24
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=add")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=add"
)
Copy link
Author

Choose a reason for hiding this comment

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

Function test_dashboard_createuser refactored with the following changes:

Comment on lines -31 to +35
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=add")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=groups&action=add"
)
Copy link
Author

Choose a reason for hiding this comment

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

Function test_dashboard_creategroup refactored with the following changes:

Comment on lines -92 to +106
page.fill("//html/body/div/div[4]/div/form/table/tbody/tr[1]/td[3]/input", "Group Created by playwright By Dashboard " + group_name)
page.fill(
"//html/body/div/div[4]/div/form/table/tbody/tr[1]/td[3]/input",
f"Group Created by playwright By Dashboard {group_name}",
)

page.click(".btnPrimary[type='submit']")

result_on_server = sqlcheck("dyngroup", "SELECT count(*) from Groups WHERE name = 'Group Created by playwright By Dashboard " + group_name + "'")
result_on_server = sqlcheck(
"dyngroup",
f"SELECT count(*) from Groups WHERE name = 'Group Created by playwright By Dashboard {group_name}'",
)
Copy link
Author

Choose a reason for hiding this comment

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

Function template_create_group_by_status refactored with the following changes:

Comment on lines -106 to +119
status = sqlcheck("xmppmaster", "SELECT status FROM uptime_machine WHERE hostname = '" + machineName + "' ORDER BY id DESC LIMIT 1")
status = sqlcheck(
"xmppmaster",
f"SELECT status FROM uptime_machine WHERE hostname = '{machineName}' ORDER BY id DESC LIMIT 1",
)
Copy link
Author

Choose a reason for hiding this comment

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

Function test_create_groupe_by_dashboard_machine_online refactored with the following changes:

Comment on lines -135 to +162
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=index"
)
page.click(id_code + test_user + ' .delete a')
page.click('#delfiles')
page.click(".btnPrimary[type='submit']")

# Testing if the popup is from the alert-success class and if it has the right text
locator = page.locator('#__popup_container .alert.alert-success')
expect(locator).to_have_text('User ' + test_user + ' has been successfully deleted')
expect(locator).to_have_text(f'User {test_user} has been successfully deleted')
Copy link
Author

Choose a reason for hiding this comment

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

Function test_delete_users refactored with the following changes:

Comment on lines -32 to +34
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=computers&action=machinesList")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=computers&action=machinesList"
)
Copy link
Author

Choose a reason for hiding this comment

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

Function test_open_inventory refactored with the following changes:

Comment on lines -39 to +48
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=computers&action=machinesList")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=computers&action=machinesList"
)

page.click('#listFavourite')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=computers&action=listFavourite")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=computers&action=listFavourite"
)
Copy link
Author

Choose a reason for hiding this comment

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

Function test_open_favouriteGroup refactored with the following changes:

Comment on lines -49 to +62
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=computers&action=machinesList")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=computers&action=machinesList"
)

page.click('#list')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=computers&action=list")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=computers&action=list"
)
Copy link
Author

Choose a reason for hiding this comment

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

Function test_open_AllGroups refactored with the following changes:

Comment on lines -60 to +77
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=computers&action=machinesList")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=computers&action=machinesList"
)

page.click('#computersgroupcreator')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=computers&action=computersgroupcreator")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=computers&action=computersgroupcreator"
)
Copy link
Author

Choose a reason for hiding this comment

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

Function test_open_CreateGroups refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Mar 27, 2023

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 1.22 ⭐ 1.20 ⭐ -0.02 👍
Method Length 79.09 🙂 80.21 🙂 1.12 👎
Working memory 4.04 ⭐ 4.06 ⭐ 0.02 👎
Quality 80.90% 80.65% -0.25% 👎
Other metrics Before After Change
Lines 4305 4779 474
Changed files Quality Before Quality After Quality Change
functional/common.py 84.16% ⭐ 84.12% ⭐ -0.04% 👎
functional/test_00001_dashboard.py 85.46% ⭐ 85.41% ⭐ -0.05% 👎
functional/test_00002_groups.py 87.86% ⭐ 87.62% ⭐ -0.24% 👎
functional/test_00003_users.py 84.63% ⭐ 84.42% ⭐ -0.21% 👎
functional/test_00005_computers.py 87.39% ⭐ 87.22% ⭐ -0.17% 👎
functional/test_00005_computers_groups.py 81.39% ⭐ 81.12% ⭐ -0.27% 👎
functional/test_00006_imaging.py 92.82% ⭐ 92.54% ⭐ -0.28% 👎
functional/test_00007_deploiement.py 74.04% 🙂 72.85% 🙂 -1.19% 👎
functional/test_00007_packages.py 82.20% ⭐ 81.93% ⭐ -0.27% 👎
functional/test_00008_audit.py 92.91% ⭐ 92.64% ⭐ -0.27% 👎
functional/test_00009_update.py 79.76% ⭐ 79.63% ⭐ -0.13% 👎
functional/test_00011_services.py 91.46% ⭐ 91.27% ⭐ -0.19% 👎
functional/test_00012_history.py 93.46% ⭐ 93.18% ⭐ -0.28% 👎
functional/test_00013_admin.py 87.45% ⭐ 87.09% ⭐ -0.36% 👎
functional/test_regression_2069.py 74.23% 🙂 73.06% 🙂 -1.17% 👎
performance/libs/cleanup_tests.py 51.06% 🙂 51.55% 🙂 0.49% 👍
performance/libs/process_results.py 68.69% 🙂 68.40% 🙂 -0.29% 👎
performance/libs/xmpprecipient.py 68.68% 🙂 68.22% 🙂 -0.46% 👎
performance/libs/xmppsender.py 68.75% 🙂 68.66% 🙂 -0.09% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
performance/libs/xmpprecipient.py configuration.__init__ 17 🙂 220 ⛔ 8 🙂 45.61% 😞 Try splitting into smaller methods
performance/libs/cleanup_tests.py delete_machine_from_glpi 7 ⭐ 181 😞 12 😞 49.42% 😞 Try splitting into smaller methods. Extract out complex expressions
performance/libs/xmpprecipient.py add_coloring_to_emit_windows 7 ⭐ 185 😞 54.46% 🙂 Try splitting into smaller methods
performance/libs/xmppsender.py add_coloring_to_emit_windows 7 ⭐ 185 😞 54.46% 🙂 Try splitting into smaller methods
performance/libs/xmppsender.py generate_json_register 3 ⭐ 149 😞 13 😞 54.83% 🙂 Try splitting into smaller methods. 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!

Help us improve this quality report!

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.

0 participants