Skip to content
This repository has been archived by the owner on Nov 11, 2022. It is now read-only.

Sourcery refactored main branch #1

Merged
merged 2 commits into from
Mar 15, 2022
Merged

Sourcery refactored main branch #1

merged 2 commits into from
Mar 15, 2022

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Mar 15, 2022

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 cesarcoatl March 15, 2022 21:33
Comment on lines -36 to +37
version_1.append(self.build)
version_1.append(self.beta)
version_1.append(self.rc)
version_2.append(other.build)
version_2.append(other.beta)
version_2.append(other.rc)

version_1.extend((self.build, self.beta, self.rc))
version_2.extend((other.build, other.beta, other.rc))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Version.__eq__ refactored with the following changes:

Comment on lines 78 to 77
if self.rc > 0:
ret = "{}.{}.{}-rc{}".format(self.major, self.minor, self.rev, self.rc)
else:
ret = "{}.{}.{}".format(self.major, self.minor, self.rev)
return ret
return (
f"{self.major}.{self.minor}.{self.rev}-rc{self.rc}"
if self.rc > 0
else f"{self.major}.{self.minor}.{self.rev}"
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Version.getBasicString refactored with the following changes:

Comment on lines 127 to 122
return "{}.{}.{}.{}".format(self.major, self.minor, self.rev, self.build)
return f"{self.major}.{self.minor}.{self.rev}.{self.build}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Version.toParseableString refactored with the following changes:

Comment on lines 131 to 132
version = "{}.{}.{}-rc{} (b{})".format(
self.major, self.minor, self.rev, self.rc, self.build
)
return f"{self.major}.{self.minor}.{self.rev}-rc{self.rc} (b{self.build})"
elif self.isSnapshot():
version = "{}.{}.{}-SNAPSHOT (b{})".format(
self.major, self.minor, self.rev, self.build
)
return f"{self.major}.{self.minor}.{self.rev}-SNAPSHOT (b{self.build})"
elif self.build is not None:
version = "{}.{}.{} (b{})".format(
self.major, self.minor, self.rev, self.build
)
return f"{self.major}.{self.minor}.{self.rev} (b{self.build})"
else:
version = "{}.{}.{}".format(self.major, self.minor, self.rev)
return version
return f"{self.major}.{self.minor}.{self.rev}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Version.toString refactored with the following changes:

Comment on lines 72 to 74
ret += "_{}".format(self.country)
ret += f"_{self.country}"
if self.variant:
ret += "_{}".format(self.variant)
ret += f"_{self.variant}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Locale.__str__ refactored with the following changes:

suffix = ".{}".format(extension)
suffix = f".{extension}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function getTempFile refactored with the following changes:

label = JLabel("{}: ".format(message))
label = JLabel(f"{message}: ")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function inputBox refactored with the following changes:

raise KeyError("Invalid UUID string: {}".format(instanceId))
raise KeyError(f"Invalid UUID string: {instanceId}")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function cancelChart refactored with the following changes:

raise KeyError("Invalid UUID string: {}".format(instanceId))
raise KeyError(f"Invalid UUID string: {instanceId}")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function pauseChart refactored with the following changes:

raise KeyError("Invalid UUID string: {}".format(instanceId))
raise KeyError(f"Invalid UUID string: {instanceId}")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function resumeChart refactored with the following changes:

- add sourcery configuration file
- rollback unwanted refactorings
@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Mar 15, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 0.84 ⭐ 0.66 ⭐ -0.18 👍
Method Length 23.23 ⭐ 22.82 ⭐ -0.41 👍
Working memory 3.45 ⭐ 3.26 ⭐ -0.19 👍
Quality 89.12% 89.98% 0.86% 👍
Other metrics Before After Change
Lines 857 850 -7
Changed files Quality Before Quality After Quality Change
src/com/inductiveautomation/ignition/common/model/init.py 84.93% ⭐ 87.67% ⭐ 2.74% 👍
src/system/date.py 90.84% ⭐ 90.85% ⭐ 0.01% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
src/system/date.py format 0 ⭐ 379 ⛔ 3 ⭐ 68.29% 🙂 Try splitting into smaller methods

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!

@cesarcoatl cesarcoatl merged commit 339de11 into main Mar 15, 2022
@cesarcoatl cesarcoatl deleted the sourcery/main branch March 15, 2022 23:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant