commitindex: various invoke lint errors for commitindex modules (
bug 1353062) r?davidwalsh
MozReview-Commit-ID: GxX2Agtlyx1
--- a/commitindex/commitindex/commitindex.py
+++ b/commitindex/commitindex/commitindex.py
@@ -1,12 +1,11 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-import os
import click
import connexion
from connexion.resolver import RestyResolver
app = connexion.App(__name__, specification_dir='spec/')
app.add_api('swagger.yml', resolver=RestyResolver('commitindex.api'))
--- a/commitindex/commitindex/reviews/bugzilla.py
+++ b/commitindex/commitindex/reviews/bugzilla.py
@@ -4,17 +4,16 @@
"""Interface to a Bugzilla system."""
from urllib.parse import quote
import json
import logging
import requests
from base64 import b64encode
-
logger = logging.getLogger(__name__)
class Bugzilla(object):
"""
Interface to a Bugzilla system.
TODO:
--- a/commitindex/commitindex/reviews/triggers.py
+++ b/commitindex/commitindex/reviews/triggers.py
@@ -18,9 +18,13 @@ def trigger_review(commits):
commit_data = {}
commit_data['data'] = """diff --git a/dirs/source.py b/dirs/source.py
--- a/dirs/source.py
+++ b/dirs/source.py
@@ -1,8 +1,17 @@
+from commitindex.reviews.bugzilla import Bugzilla"""
- diff_id = get_bugzilla_client().create_attachment(1, commit_data)
+ commit['attachment_id'] = get_bugzilla_client().create_attachment(
+ 1, commit_data
+ )
+
+ return commits
--- a/commitindex/tests/test_bmo_attachments.py
+++ b/commitindex/tests/test_bmo_attachments.py
@@ -1,21 +1,19 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Mountebank test cases for commit-index
"""
-import requests
-
from commitindex.commitindex import app
from commitindex.reviews import triggers
from commitindex.reviews.bugzilla import Bugzilla
-from commitindex.reviews.triggers import get_bugzilla_client, trigger_review
+from commitindex.reviews.triggers import trigger_review
from testing import MountebankClient
import pytest
from unittest.mock import MagicMock, call
from flask import current_app
@@ -155,18 +153,17 @@ def test_trigger_review_creates_attachme
commits = [{"id": "1"}, {"id": "1"}, {"id": "1"}]
bugzilla = MagicMock()
def get_bugzilla_stub():
return bugzilla
monkeypatch.setattr(
- "commitindex.reviews.triggers.get_bugzilla_client",
- get_bugzilla_stub
+ "commitindex.reviews.triggers.get_bugzilla_client", get_bugzilla_stub
)
trigger_review(commits)
expected_calls = [
call.create_attachment(1, commits[0]),
call.create_attachment(1, commits[1]),
call.create_attachment(1, commits[2]),
--- a/tasks.py
+++ b/tasks.py
@@ -289,16 +289,17 @@ def stagingrepo_format_all(ctx):
' py2-linter'
' yapf'
' --in-place --recursive'
' stagingrepo'
''.format(project_root=project_root),
echo=True
)
+
@task(name='flake8')
def staginghgserver_lint_flake8(ctx):
"""Run flake8"""
run(
'docker-compose'
' -f {project_root}/docker/docker-compose.yml'
' run'
' --rm'
@@ -347,16 +348,17 @@ def staginghgserver_format_all(ctx):
' py2-linter'
' yapf'
' --in-place --recursive'
' staginghgserver'
''.format(project_root=project_root),
echo=True
)
+
@task(name='flake8')
def lint_tasks_flake8(ctx):
"""Run flake8"""
run(
'docker-compose'
' -f {project_root}/docker/docker-compose.yml'
' run'
' --rm'