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 #6

Closed
wants to merge 1 commit into from
Closed

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Sep 2, 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 adbar September 2, 2022 15:50
def hyphenated_filter(vocab: Dict[str, Entry], perc: float=50, verbose: bool=False) -> Dict[str, Entry]: # threshold in percent
def hyphenated_filter(vocab: Dict[str, Entry], perc: float=50, verbose: bool=False) -> Dict[str, Entry]: # threshold in percent
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 hyphenated_filter refactored with the following changes:

Comment on lines -258 to +261
if oldnessindex < datethreshold:
#if oldnessindex < np.percentile(series, percentage):
# continue
if freshnessindex < np.percentile(series, percentage):
deletions.append(token)
# print(vocab[token], freshnessindex, oldnessindex, token)
if oldnessindex < datethreshold and freshnessindex < np.percentile(
series, percentage
):
deletions.append(token)
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 freshness_filter refactored with the following changes:

This removes the following comments ( why? ):

#    continue
#if oldnessindex < np.percentile(series, percentage):
# print(vocab[token], freshnessindex, oldnessindex, token)

Comment on lines -329 to +332
if keep_words is False:
deletions = list(intersection)
else:
deletions = [w for w in vocab if w not in intersection]
deletions = (
[w for w in vocab if w not in intersection]
if keep_words
else list(intersection)
)

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 wordlist_filter refactored with the following changes:

match = DATESEARCH.search(thepath)
if match:
if match := DATESEARCH.search(thepath):
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 find_files refactored with the following changes:

Comment on lines -184 to +183
if details is True:
if details:
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 read_file refactored with the following changes:

@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Sep 2, 2022

Sourcery Code Quality Report

Merging this PR leaves code quality unchanged.

Quality metrics Before After Change
Complexity 7.33 ⭐ 7.27 ⭐ -0.06 👍
Method Length 88.33 🙂 88.15 🙂 -0.18 👍
Working memory 8.96 🙂 8.98 🙂 0.02 👎
Quality 64.16% 🙂 64.16% 🙂 0.00%
Other metrics Before After Change
Lines 788 787 -1
Changed files Quality Before Quality After Quality Change
shoten/filters.py 66.16% 🙂 66.24% 🙂 0.08% 👍
shoten/shoten.py 61.80% 🙂 61.72% 🙂 -0.08% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
shoten/shoten.py gen_wordlist 17 🙂 168 😞 16 ⛔ 36.46% 😞 Try splitting into smaller methods. Extract out complex expressions
shoten/shoten.py read_file 14 🙂 216 ⛔ 11 😞 42.14% 😞 Try splitting into smaller methods. Extract out complex expressions
shoten/shoten.py compute_frequencies 11 🙂 158 😞 11 😞 49.58% 😞 Try splitting into smaller methods. Extract out complex expressions
shoten/filters.py sources_freqfilter 11 🙂 125 😞 12 😞 51.52% 🙂 Try splitting into smaller methods. Extract out complex expressions
shoten/filters.py compound_filter 11 🙂 139 😞 11 😞 51.61% 🙂 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!

@adbar adbar closed this Sep 2, 2022
@adbar adbar deleted the sourcery/main branch September 2, 2022 15:56
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.

None yet

1 participant