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 master branch #2

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

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Jul 12, 2022

Branch master 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 master branch, then run:

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from thisguy726 July 12, 2022 20:40
print("Usage: {} <host triplet> [<gcc version>] [<cxxabi11>]".format(sys.argv[0]))
print(f"Usage: {sys.argv[0]} <host triplet> [<gcc version>] [<cxxabi11>]")
Copy link
Author

Choose a reason for hiding this comment

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

Lines 9-48 refactored with the following changes:

Comment on lines -104 to +109
return '-' + x
return f'-{x}'
Copy link
Author

Choose a reason for hiding this comment

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

Function p refactored with the following changes:

Comment on lines -110 to +135
if libgfortran_version == "blank_libgfortran":
if len(sys.argv) >= 3:
# If there was no gfortran/gcc version passed in, default to the latest libgfortran version
if not sys.argv[2]:
libgfortran_version = "libgfortran5"
if libgfortran_version == "blank_libgfortran" and len(sys.argv) >= 3:
# If there was no gfortran/gcc version passed in, default to the latest libgfortran version
if not sys.argv[2]:
libgfortran_version = "libgfortran5"
else:
# Take the last thing that looks like a version number, and extract its major component
version_numbers = list(filter(lambda x: re.match("\d+\.\d+(\.\d+)?", x), sys.argv[2].split()))
major_ver = int(version_numbers[-1].split('.')[0])
if major_ver <= 6:
libgfortran_version = "libgfortran3"
elif major_ver <= 7:
libgfortran_version = "libgfortran4"
else:
# Take the last thing that looks like a version number, and extract its major component
version_numbers = list(filter(lambda x: re.match("\d+\.\d+(\.\d+)?", x), sys.argv[2].split()))
major_ver = int(version_numbers[-1].split('.')[0])
if major_ver <= 6:
libgfortran_version = "libgfortran3"
elif major_ver <= 7:
libgfortran_version = "libgfortran4"
else:
libgfortran_version = "libgfortran5"

if cxx_abi == "blank_cxx_abi":
if len(sys.argv) == 4:
cxx_abi = {
"0": "cxx03",
"1": "cxx11",
"": "",
}[sys.argv[3]]
libgfortran_version = "libgfortran5"

if cxx_abi == "blank_cxx_abi" and len(sys.argv) == 4:
cxx_abi = {
"0": "cxx03",
"1": "cxx11",
"": "",
}[sys.argv[3]]
Copy link
Author

Choose a reason for hiding this comment

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

Lines 110-132 refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Jul 12, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 5.52 ⭐ 4.24 ⭐ -1.28 👍
Method Length 72.00 🙂 72.83 🙂 0.83 👎
Working memory 8.89 🙂 9.09 🙂 0.20 👎
Quality 69.48% 🙂 70.56% 🙂 1.08% 👍
Other metrics Before After Change
Lines 122 125 3
Changed files Quality Before Quality After Quality Change
contrib/normalize_triplet.py 69.48% 🙂 70.56% 🙂 1.08% 👍

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

File Function Complexity Length Working Memory Quality Recommendation

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
0 participants