Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Jun 4, 2022
1 parent 401f457 commit 6845d62
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions github3_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ def iter_repos(
:param orgs: An iterable of organization names to fetch the repositories for.
"""

# pylint: disable=loop-invariant-statement
for user in users:
_user: Optional[User] = github.user(user)
if _user is None:
Expand All @@ -319,3 +320,4 @@ def iter_repos(
raise ValueError(f"No such organization {org}")

yield from get_repos(_org, full=False)
# pylint: enable=loop-invariant-statement
6 changes: 5 additions & 1 deletion github3_utils/check_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def get_checks_for_pr(pull: Union[PullRequest, ShortPullRequest]) -> Checks:
check_run: CheckRun
for check_run in head_commit.check_runs():

# pylint: disable=loop-invariant-statement
if check_run.status in {"queued", "running", "in_progress"}:
running.add(check_run.name)
elif check_run.conclusion in {"failure", "cancelled", "timed_out", "action_required"}:
Expand All @@ -143,6 +144,7 @@ def get_checks_for_pr(pull: Union[PullRequest, ShortPullRequest]) -> Checks:
skipped.add(check_run.name)
elif check_run.conclusion == "neutral":
neutral.add(check_run.name)
# pylint: enable=loop-invariant-statement

# Remove failing checks from successful etc. (as all checks appear twice for PRs)
successful = successful - failing - running
Expand Down Expand Up @@ -178,9 +180,10 @@ def label_pr_failures(pull: Union[PullRequest, ShortPullRequest]) -> Set[str]:

def determine_labels(from_: Set[str], to: Set[str]) -> None:
for check in from_:
if _python_dev_re.match(check):
if _python_dev_re.match(check): # pylint: disable=loop-global-usage
continue

# pylint: disable=loop-invariant-statement
if check in {"Flake8", "docs"}:
to.add(f"failure: {check.lower()}")
elif check.startswith("mypy"):
Expand All @@ -189,6 +192,7 @@ def determine_labels(from_: Set[str], to: Set[str]) -> None:
to.add("failure: Linux")
elif check.startswith("windows"):
to.add("failure: Windows")
# pylint: enable=loop-invariant-statement

determine_labels(pr_checks.failing, failure_labels)
determine_labels(pr_checks.successful, success_labels)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_click.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_token_option_alt_name(

@token_option("MA_TOKEN")
@click_command()
def demo(token: str):
def demo(token: str) -> None:
click.echo(f"The token is: {token}")

runner = CliRunner()
Expand Down

0 comments on commit 6845d62

Please sign in to comment.