Skip to content

Conversation

@sourcery-ai
Copy link

@sourcery-ai sourcery-ai bot commented Sep 27, 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 garlontas September 27, 2022 13:18
identifier = AudioFileIdentifier(files[0])
id = identifier.identify
print('http://musicbrainz.org/recording/%s' % id)
print(f'http://musicbrainz.org/recording/{id}')
Copy link
Author

Choose a reason for hiding this comment

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

Lines 18-18 refactored with the following changes:

Comment on lines -18 to +24
shutil.move(file, os.path.join(
self.root, self.__create_file_name_structure() + "." + file.split(".")[-1]))
shutil.move(
file,
os.path.join(
self.root,
f"{self.__create_file_name_structure()}." + file.split(".")[-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 FileRestructurer.move refactored with the following changes:

Comment on lines -21 to +22
match = re.search(table_pattern, html.text)
if match:
match = re.search(id_section_pattern, match.group())
if match:
if match := re.search(table_pattern, html.text):
if match := re.search(id_section_pattern, match.group()):
Copy link
Author

Choose a reason for hiding this comment

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

Function get_api_key refactored with the following changes:

self.excluded_items = []
for i in list(excluded_dirs[0]):
self.excluded_items.append(os.path.abspath(i))
self.excluded_items = [os.path.abspath(i) for i in list(excluded_dirs[0])]
Copy link
Author

Choose a reason for hiding this comment

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

Function AudioFileLocator.__init__ refactored with the following changes:

Comment on lines -34 to +32
result = glob.glob(self.root + "/**/*.*", recursive=True)
result = glob.glob(f"{self.root}/**/*.*", recursive=True)
Copy link
Author

Choose a reason for hiding this comment

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

Function AudioFileLocator.__get_files_recursive refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Sep 27, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 3.73 ⭐ 3.76 ⭐ 0.03 👎
Method Length 55.54 ⭐ 55.08 ⭐ -0.46 👍
Working memory 7.37 🙂 7.91 🙂 0.54 👎
Quality 74.53% 🙂 72.95% 🙂 -1.58% 👎
Other metrics Before After Change
Lines 127 128 1
Changed files Quality Before Quality After Quality Change
test.py 52.83% 🙂 52.75% 🙂 -0.08% 👎
audioman/files/restructure.py 80.42% ⭐ 80.39% ⭐ -0.03% 👎
audioman/fingerprint/api.py 87.07% ⭐ 83.86% ⭐ -3.21% 👎
audioman/locator/audio_file_locator.py 75.85% ⭐ 73.59% 🙂 -2.26% 👎

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!

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

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.

1 participant