Skip to content

Commit

Permalink
Merge 45705f8 into 6c0fef3
Browse files Browse the repository at this point in the history
  • Loading branch information
timgates42 committed Apr 23, 2020
2 parents 6c0fef3 + 45705f8 commit 280799b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
9 changes: 8 additions & 1 deletion app/meticulous/_github.py
Expand Up @@ -2,6 +2,8 @@
Handlers for checking existing forks and creating new ones.
"""

import logging

import github
from plumbum import local

Expand Down Expand Up @@ -118,7 +120,12 @@ def get_parent_repo(reponame):
"""
api = get_api()
user_org = api.get_user().login
repo = api.get_repo(f"{user_org}/{reponame}")
orgrepo = f"{user_org}/{reponame}"
try:
repo = api.get_repo(orgrepo)
except github.GithubException:
logging.exception("Failed to lookup %s", orgrepo)
raise
while repo.parent and not repo.parent.archived:
repo = repo.parent
return repo
Expand Down
19 changes: 10 additions & 9 deletions app/meticulous/_process.py
Expand Up @@ -12,10 +12,9 @@
import unanimous.version
from colorama import Fore, Style, init
from plumbum import FG, local
from spelling.store import get_store
from workflow.engine import GenericWorkflowEngine

from meticulous._addrepo import interactive_add_one_new_repo
from meticulous._addrepo import interactive_add_one_new_repo, spelling_check
from meticulous._cleanup import remove_repo_for
from meticulous._exceptions import NoRepoException, ProcessingFailed
from meticulous._input import (
Expand Down Expand Up @@ -108,7 +107,7 @@ def manual_menu(target):
"add a new repository": add_new_repo,
"prepare a change": prepare_a_change,
"prepare a pr/issue": prepare_a_pr_or_issue,
"show statistics": show_statistics,
"total annihilation": total_annihilation,
}
handler = make_choice(lookup)
if handler is None:
Expand All @@ -119,14 +118,16 @@ def manual_menu(target):
continue


def show_statistics(target):
def total_annihilation(target):
"""
Display details about the most common words
Remove all spelling mistakes from a repository
"""
storage_path = get_spelling_store_path(target)
store = get_store(storage_path)
word_count = store.load_word_count()
print(repr(word_count))
reponame, repodir = pick_repo()
jsonpath = Path(repodir) / "spelling.json"
if not jsonpath.exists():
print("Checking spelling...")
spelling_check(repodir, target)
interactive_task_collect_nonwords(reponame, target, nonstop=True)


def remove_repo_selection(target): # pylint: disable=unused-argument
Expand Down
4 changes: 2 additions & 2 deletions app/meticulous/_processrepo.py
Expand Up @@ -113,7 +113,7 @@ def handler():


def interactive_task_collect_nonwords( # pylint: disable=unused-argument
reponame, target, nonword_delegate=None
reponame, target, nonword_delegate=None, nonstop=False,
):
"""
Saves nonwords until a typo is found
Expand Down Expand Up @@ -144,7 +144,7 @@ def interactive_task_collect_nonwords( # pylint: disable=unused-argument
try:
my_engine.process([state])
except HaltProcessing:
if state.done:
if state.done and not nonstop:
return
print(f"{Fore.YELLOW}Completed checking all words for {reponame}!{Style.RESET_ALL}")

Expand Down

0 comments on commit 280799b

Please sign in to comment.