Skip to content

Commit

Permalink
Merge pull request #1 from yukw777/fix-438-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
itajaja authored Apr 29, 2020
2 parents de5723e + eba7046 commit 80965ae
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions black.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
Pattern,
Sequence,
Set,
Sized,
Tuple,
TypeVar,
Union,
Expand Down Expand Up @@ -472,7 +473,7 @@ def main(
report = Report(check=check, diff=diff, quiet=quiet, verbose=verbose)
root = find_project_root(src)
sources: Set[Path] = set()
path_empty(src, quiet, verbose, ctx)
path_empty(src, "No Path provided. Nothing to do 😴", quiet, verbose, ctx)
for s in src:
p = Path(s)
if p.is_dir():
Expand All @@ -497,10 +498,13 @@ def main(
else:
err(f"invalid path: {s}")

if len(sources) == 0:
if verbose or not quiet:
out("No Python files are present to be formatted. Nothing to do 😴")
ctx.exit(0)
path_empty(
sources,
"No Python files are present to be formatted. Nothing to do 😴",
quiet,
verbose,
ctx,
)

if len(sources) == 1:
reformat_one(
Expand All @@ -522,14 +526,14 @@ def main(


def path_empty(
src: Tuple[str, ...], quiet: bool, verbose: bool, ctx: click.Context
src: Sized, msg: str, quiet: bool, verbose: bool, ctx: click.Context
) -> None:
"""
Exit if there is no `src` provided for formatting
"""
if not src:
if len(src) == 0:
if verbose or not quiet:
out("No Path provided. Nothing to do 😴")
out(msg)
ctx.exit(0)


Expand Down

0 comments on commit 80965ae

Please sign in to comment.