Skip to content

Commit

Permalink
Fix linting missing files.
Browse files Browse the repository at this point in the history
Excluding `build` for black isn't a great idea when travis is checking
out under `/home/travis/build/open-telemetry`.
  • Loading branch information
Oberon00 committed Nov 15, 2019
1 parent c38b2fb commit e62f5bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ exclude = '''
| \.venv.*
| venv.*
| \.vscode
| _build
| build
| dist
| ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/gen # generated files
)/
Expand Down
16 changes: 8 additions & 8 deletions scripts/eachdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ def subprocess_run(*args, **kwargs):
if check:
subprocess.check_call(*args, **kwargs)
return CompletedProcess(returncode=0)
else:
return CompletedProcess(
returncode=subprocess.call(*args, **kwargs)
)
return CompletedProcess(returncode=subprocess.call(*args, **kwargs))


def parse_args(args=None):
Expand Down Expand Up @@ -135,9 +132,9 @@ def find_targets(mode, rootpath):

def keyfunc(path):
path = path.relative_to(rootpath)
for i, pattern in enumerate(sortfirst):
for idx, pattern in enumerate(sortfirst):
if path.match(pattern):
return i
return idx
return float("inf")

targets.sort(key=keyfunc)
Expand Down Expand Up @@ -172,6 +169,8 @@ def runsubprocess(dry_run, params, *args, **kwargs):
if cwd and isinstance(cwd, PurePath):
kwargs["cwd"] = str(cwd)

check = kwargs.pop("check") # Enforce specifying check

print(">>>", cmdstr, file=sys.stderr)

# This is a workaround for subprocess.run(['python']) leaving the virtualenv on Win32.
Expand All @@ -189,7 +188,7 @@ def runsubprocess(dry_run, params, *args, **kwargs):
if executable:
params[0] = executable
try:
return subprocess_run(params, *args, **kwargs)
return subprocess_run(params, *args, check=check, **kwargs)
except OSError as exc:
raise ValueError(
"Failed executing " + repr(params) + ": " + str(exc)
Expand Down Expand Up @@ -322,7 +321,8 @@ def lint_args(args):
runsubprocess(args.dry_run, ("flake8", rootdir), check=True)
execute_args(
parse_subargs(
args, ("exec", "pylint {}", "--all", "--mode", "lintroots",),
args,
("exec", "pylint scripts/ {}", "--all", "--mode", "lintroots",),
)
)

Expand Down

0 comments on commit e62f5bc

Please sign in to comment.