Just use flake8 instead of hacking
We don't use hacking in Infra. Use flake8 instead. Change-Id: I04ac08a0c4218398b43e906a6d65f75b3ff104c3
This commit is contained in:
parent
90b98698c3
commit
96ca93b2e3
@ -44,7 +44,7 @@ import github
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import jeepyb.log as l
|
import jeepyb.log
|
||||||
import jeepyb.projects as p
|
import jeepyb.projects as p
|
||||||
import jeepyb.utils as u
|
import jeepyb.utils as u
|
||||||
|
|
||||||
@ -67,12 +67,12 @@ log = logging.getLogger("close_pull_requests")
|
|||||||
def main():
|
def main():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
l.setup_logging_arguments(parser)
|
jeepyb.log.setup_logging_arguments(parser)
|
||||||
parser.add_argument('--message-file', dest='message_file', default=None,
|
parser.add_argument('--message-file', dest='message_file', default=None,
|
||||||
help='The close pull request message')
|
help='The close pull request message')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
l.configure_logging(args)
|
jeepyb.log.configure_logging(args)
|
||||||
|
|
||||||
if args.message_file:
|
if args.message_file:
|
||||||
try:
|
try:
|
||||||
@ -136,5 +136,6 @@ def main():
|
|||||||
issue.create_comment(pull_request_text % vars)
|
issue.create_comment(pull_request_text % vars)
|
||||||
req.edit(state="closed")
|
req.edit(state="closed")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import jeepyb.utils as u
|
||||||
|
|
||||||
# Python2 has unicode as a builtin
|
# Python2 has unicode as a builtin
|
||||||
# Python3 does not
|
# Python3 does not
|
||||||
import sys
|
import sys
|
||||||
if sys.version_info[0] >= 3:
|
if sys.version_info[0] >= 3:
|
||||||
unicode = str
|
unicode = str
|
||||||
|
|
||||||
import jeepyb.utils as u
|
|
||||||
|
|
||||||
|
|
||||||
PROJECTS_YAML = os.environ.get('PROJECTS_YAML', '/home/hound/projects.yaml')
|
PROJECTS_YAML = os.environ.get('PROJECTS_YAML', '/home/hound/projects.yaml')
|
||||||
GIT_SERVER = os.environ.get('GIT_BASE', 'opendev.org')
|
GIT_SERVER = os.environ.get('GIT_BASE', 'opendev.org')
|
||||||
|
@ -22,16 +22,16 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import paramiko
|
import paramiko
|
||||||
|
|
||||||
import jeepyb.log as l
|
import jeepyb.log
|
||||||
|
|
||||||
logger = logging.getLogger('expire_reviews')
|
logger = logging.getLogger('expire_reviews')
|
||||||
|
|
||||||
|
|
||||||
def expire_patch_set(ssh, patch_id, patch_subject):
|
def expire_patch_set(ssh, patch_id, patch_subject):
|
||||||
message = ('Code review expired due to no recent activity'
|
message = ("Code review expired due to no recent activity"
|
||||||
' after a negative review. It can be restored using'
|
" after a negative review. It can be restored using"
|
||||||
' the \`Restore Change\` button under the Patch Set'
|
" the 'Restore Change' button under the Patch Set"
|
||||||
' on the web interface.')
|
" on the web interface.")
|
||||||
command = ('gerrit review --abandon '
|
command = ('gerrit review --abandon '
|
||||||
'--message="{message}" {patch_id}').format(
|
'--message="{message}" {patch_id}').format(
|
||||||
message=message,
|
message=message,
|
||||||
@ -50,9 +50,9 @@ def main():
|
|||||||
parser.add_argument('ssh_key', help='The gerrit admin SSH key file')
|
parser.add_argument('ssh_key', help='The gerrit admin SSH key file')
|
||||||
parser.add_argument('--age', dest='age', default='1w',
|
parser.add_argument('--age', dest='age', default='1w',
|
||||||
help='The minimum age of a review to expire')
|
help='The minimum age of a review to expire')
|
||||||
l.setup_logging_arguments(parser)
|
jeepyb.log.setup_logging_arguments(parser)
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
l.configure_logging(options)
|
jeepyb.log.configure_logging(options)
|
||||||
|
|
||||||
GERRIT_USER = options.user
|
GERRIT_USER = options.user
|
||||||
GERRIT_SSH_KEY = options.ssh_key
|
GERRIT_SSH_KEY = options.ssh_key
|
||||||
@ -85,5 +85,6 @@ def main():
|
|||||||
|
|
||||||
logger.info('End expire review')
|
logger.info('End expire review')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -65,7 +65,7 @@ import time
|
|||||||
import gerritlib.gerrit
|
import gerritlib.gerrit
|
||||||
import github
|
import github
|
||||||
|
|
||||||
import jeepyb.log as l
|
import jeepyb.log
|
||||||
import jeepyb.utils as u
|
import jeepyb.utils as u
|
||||||
|
|
||||||
registry = u.ProjectsRegistry()
|
registry = u.ProjectsRegistry()
|
||||||
@ -415,13 +415,13 @@ def create_local_mirror(local_git_dir, project_git,
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Manage projects')
|
parser = argparse.ArgumentParser(description='Manage projects')
|
||||||
l.setup_logging_arguments(parser)
|
jeepyb.log.setup_logging_arguments(parser)
|
||||||
parser.add_argument('--nocleanup', action='store_true',
|
parser.add_argument('--nocleanup', action='store_true',
|
||||||
help='do not remove temp directories')
|
help='do not remove temp directories')
|
||||||
parser.add_argument('projects', metavar='project', nargs='*',
|
parser.add_argument('projects', metavar='project', nargs='*',
|
||||||
help='name of project(s) to process')
|
help='name of project(s) to process')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
l.configure_logging(args)
|
jeepyb.log.configure_logging(args)
|
||||||
|
|
||||||
default_has_github = registry.get_defaults('has-github', True)
|
default_has_github = registry.get_defaults('has-github', True)
|
||||||
|
|
||||||
|
@ -332,5 +332,6 @@ def main():
|
|||||||
if impacted(git_log, args.impact):
|
if impacted(git_log, args.impact):
|
||||||
process_impact(git_log, args, config)
|
process_impact(git_log, args, config)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -78,6 +78,7 @@ def parse_ini(inifile):
|
|||||||
OUTPUT_MODE)
|
OUTPUT_MODE)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conffile = sys.argv[1]
|
conffile = sys.argv[1]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
@ -174,5 +175,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
print(content)
|
print(content)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@ -18,7 +18,7 @@ import argparse
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import jeepyb.log as l
|
import jeepyb.log
|
||||||
import jeepyb.projects as p
|
import jeepyb.projects as p
|
||||||
import jeepyb.translations as t
|
import jeepyb.translations as t
|
||||||
import jeepyb.utils as u
|
import jeepyb.utils as u
|
||||||
@ -33,9 +33,9 @@ log = logging.getLogger('register_zanata_projects')
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Register projects in Zanata')
|
parser = argparse.ArgumentParser(description='Register projects in Zanata')
|
||||||
l.setup_logging_arguments(parser)
|
jeepyb.log.setup_logging_arguments(parser)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
l.configure_logging(args)
|
jeepyb.log.configure_logging(args)
|
||||||
|
|
||||||
registry = u.ProjectsRegistry(PROJECTS_YAML)
|
registry = u.ProjectsRegistry(PROJECTS_YAML)
|
||||||
rest_service = t.ZanataRestService(ZANATA_URL, ZANATA_USER, ZANATA_KEY)
|
rest_service = t.ZanataRestService(ZANATA_URL, ZANATA_USER, ZANATA_KEY)
|
||||||
|
@ -57,7 +57,7 @@ import os
|
|||||||
|
|
||||||
import gerritlib.gerrit
|
import gerritlib.gerrit
|
||||||
|
|
||||||
import jeepyb.log as l
|
import jeepyb.log
|
||||||
import jeepyb.utils as u
|
import jeepyb.utils as u
|
||||||
|
|
||||||
registry = u.ProjectsRegistry()
|
registry = u.ProjectsRegistry()
|
||||||
@ -142,13 +142,13 @@ def sync_upstream(repo_path, project, ssh_env, upstream_prefix):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Manage projects')
|
parser = argparse.ArgumentParser(description='Manage projects')
|
||||||
l.setup_logging_arguments(parser)
|
jeepyb.log.setup_logging_arguments(parser)
|
||||||
parser.add_argument('--nocleanup', action='store_true',
|
parser.add_argument('--nocleanup', action='store_true',
|
||||||
help='do not remove temp directories')
|
help='do not remove temp directories')
|
||||||
parser.add_argument('projects', metavar='project', nargs='*',
|
parser.add_argument('projects', metavar='project', nargs='*',
|
||||||
help='name of project(s) to process')
|
help='name of project(s) to process')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
l.configure_logging(args)
|
jeepyb.log.configure_logging(args)
|
||||||
|
|
||||||
JEEPYB_CACHE_DIR = registry.get_defaults('jeepyb-cache-dir',
|
JEEPYB_CACHE_DIR = registry.get_defaults('jeepyb-cache-dir',
|
||||||
'/var/lib/jeepyb')
|
'/var/lib/jeepyb')
|
||||||
@ -226,5 +226,6 @@ def main():
|
|||||||
finally:
|
finally:
|
||||||
os.unlink(ssh_env['GIT_SSH'])
|
os.unlink(ssh_env['GIT_SSH'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -282,5 +282,6 @@ def main():
|
|||||||
SuExec(options, approval["account_id"], ' '.join(gerrit_approve_cmd))
|
SuExec(options, approval["account_id"], ' '.join(gerrit_approve_cmd))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -59,6 +59,7 @@ def get_broken_config(filename):
|
|||||||
c.readfp(fp)
|
c.readfp(fp)
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
|
||||||
GERRIT_CONFIG = get_broken_config(GERRIT_CONFIG)
|
GERRIT_CONFIG = get_broken_config(GERRIT_CONFIG)
|
||||||
SECURE_CONFIG = get_broken_config(GERRIT_SECURE_CONFIG)
|
SECURE_CONFIG = get_broken_config(GERRIT_SECURE_CONFIG)
|
||||||
DB_HOST = GERRIT_CONFIG.get("database", "hostname")
|
DB_HOST = GERRIT_CONFIG.get("database", "hostname")
|
||||||
@ -169,5 +170,6 @@ def main():
|
|||||||
|
|
||||||
find_specs(lpconn, conn, args)
|
find_specs(lpconn, conn, args)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -31,7 +31,7 @@ import logging
|
|||||||
import paramiko
|
import paramiko
|
||||||
|
|
||||||
import jeepyb.gerritdb
|
import jeepyb.gerritdb
|
||||||
import jeepyb.log as l
|
import jeepyb.log
|
||||||
|
|
||||||
BASE_DIR = '/home/gerrit2/review_site'
|
BASE_DIR = '/home/gerrit2/review_site'
|
||||||
|
|
||||||
@ -158,16 +158,17 @@ def main():
|
|||||||
parser.add_argument('--dryrun', dest='dryrun', action='store_true')
|
parser.add_argument('--dryrun', dest='dryrun', action='store_true')
|
||||||
parser.add_argument('--no-dryrun', dest='dryrun', action='store_false')
|
parser.add_argument('--no-dryrun', dest='dryrun', action='store_false')
|
||||||
parser.set_defaults(dryrun=False)
|
parser.set_defaults(dryrun=False)
|
||||||
l.setup_logging_arguments(parser)
|
jeepyb.log.setup_logging_arguments(parser)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
l.configure_logging(args)
|
jeepyb.log.configure_logging(args)
|
||||||
|
|
||||||
# they're a first-timer, post the message on 1st patchset
|
# they're a first-timer, post the message on 1st patchset
|
||||||
if is_newbie(args.uploader) and args.patchset == '1' and not args.dryrun:
|
if is_newbie(args.uploader) and args.patchset == '1' and not args.dryrun:
|
||||||
post_message(args.commit, args.ssh_user, args.ssh_key,
|
post_message(args.commit, args.ssh_user, args.ssh_key,
|
||||||
args.message_file)
|
args.message_file)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# The order of packages is significant, because pip processes them in the order
|
# The order of packages is significant, because pip processes them in the order
|
||||||
# of appearance. Changing the order has an impact on the overall integration
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
# process, which may cause wedges in the gate later.
|
# process, which may cause wedges in the gate later.
|
||||||
hacking<0.11,>=0.10.2
|
flake8
|
||||||
|
3
tox.ini
3
tox.ini
@ -18,6 +18,7 @@ commands = {posargs}
|
|||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# E125 and H are intentionally ignored
|
# E125 and H are intentionally ignored
|
||||||
ignore = E125,H
|
# W503 is a mistake in flake8
|
||||||
|
ignore = E125,H,W503,W504
|
||||||
show-source = True
|
show-source = True
|
||||||
exclude = .venv,.tox,dist,doc,build,*.egg
|
exclude = .venv,.tox,dist,doc,build,*.egg
|
||||||
|
Loading…
Reference in New Issue
Block a user