add flake8 to the linter job

Turn on flake8 for code style checks, like in our other repos. Fix or
explicitly ignore various issues to allow the linter job to pass.

Change-Id: I7bfd8cf5e9c00dfa83c0393a4307fd54d2113047
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-03-15 17:08:53 -04:00
parent 446fc28df7
commit 1c98c456b5
11 changed files with 31 additions and 23 deletions

View File

@ -19,6 +19,7 @@ import re
from docutils import nodes
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives import tables
from docutils.utils import SystemMessagePropagation
import projects
@ -40,9 +41,6 @@ class ExtraATCsTable(tables.Table):
}
def run(self):
env = self.state.document.settings.env
app = env.app
project = self.options.get('project')
if not project:
error = self.state_machine.reporter.error(
@ -62,7 +60,7 @@ class ExtraATCsTable(tables.Table):
'Error processing memberstable directive:\n%s' % err,
nodes.literal_block(self.block_text, self.block_text),
line=self.lineno,
)
)
return [error]
all_teams = projects.get_project_data()

View File

@ -14,9 +14,9 @@
Generate badges for the projects
"""
import os
from itertools import chain
from itertools import zip_longest
import os
from PIL import ImageFont
@ -26,15 +26,15 @@ import projects
PADDING = 8
BASE_TAGS_URL = 'https://governance.openstack.org/tc/reference/tags/'
COLOR_SCHEME = {
"brightgreen": "#4c1",
"green": "#97CA00",
"yellow": "#dfb317",
"yellowgreen": "#a4a61d",
"orange": "#fe7d37",
"red": "#e05d44",
"blue": "#007ec6",
"grey": "#555",
"lightgrey": "#9f9f9f",
"brightgreen": "#4c1",
"green": "#97CA00",
"yellow": "#dfb317",
"yellowgreen": "#a4a61d",
"orange": "#fe7d37",
"red": "#e05d44",
"blue": "#007ec6",
"grey": "#555",
"lightgrey": "#9f9f9f",
}
SVG_ROOT = """<?xml version="1.0" standalone="no"?>
@ -155,6 +155,7 @@ def _organize_badges(badges):
result[y].append(badge)
return result
def _to_svg(badges):
for badge in badges:
yield FLAT_BADGE_TEMPLATE.format(**badge)

View File

@ -16,8 +16,9 @@
import re
from docutils import nodes
from docutils.parsers.rst.directives import tables
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives import tables
from docutils.utils import SystemMessagePropagation
# Full name (IRC nickname) [expires in] {role}
_PATTERN = re.compile('(?P<name>.*)\s+\((?P<irc>.*)\)\s+\[(?P<date>.*)\](\s+\{(?P<role>.*)\})?')
@ -61,7 +62,6 @@ class MembersTable(tables.Table):
def run(self):
env = self.state.document.settings.env
app = env.app
config = app.config
# The required argument to the directive is the name of the
# file to parse.
@ -84,7 +84,7 @@ class MembersTable(tables.Table):
'Error processing memberstable directive:\n%s' % err,
nodes.literal_block(self.block_text, self.block_text),
line=self.lineno,
)
)
return [error]
# Now find the real path to the file, relative to where we are.
@ -146,6 +146,7 @@ class MembersTable(tables.Table):
return table
def setup(app):
app.info('loading members extension')
app.add_directive('memberstable', MembersTable)

View File

@ -11,6 +11,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
# flake8: noqa
import sys
import os

View File

@ -3,7 +3,6 @@
"""
import csv
import sys
with open('defcore.csv', 'r') as infile:
reader = csv.reader(infile)

View File

@ -14,4 +14,7 @@ build-dir = doc/build
source-dir = doc/source
[pbr]
warnerrors = True
warnerrors = True
[flake8]
ignore = E501,E226,H405

View File

@ -5,3 +5,4 @@ PyYAML>=3.1.0
yamllint>=0.5.2
requests-cache
Pillow>=2.4.0 # PIL License
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0

View File

@ -29,7 +29,7 @@ def main():
parser = argparse.ArgumentParser(
'build the "Project Teams" section of a goal document',
)
args = parser.parse_args()
parser.parse_args()
print('Paste this output to the end of the goals file:\n')

View File

@ -120,6 +120,7 @@ def get_core_reviews_by_company(group):
return companies
@_memoize
def get_diversity_stats(project):
team_stats = {}
@ -177,7 +178,7 @@ def get_diversity_stats(project):
if core_reviewers_total else 0)
team_stats['core_reviewers_top2'] = (
((float(core_reviewers_values[0]) + float(core_reviewers_values[1])) /
core_reviewers_total * 100) if core_reviewers_total else 0)
core_reviewers_total * 100) if core_reviewers_total else 0)
return team_stats

View File

@ -37,7 +37,7 @@ team_validators = [
]
# List of modules to validate repository based tags
repo_validators = [ ]
repo_validators = []
def main():

View File

@ -12,11 +12,13 @@ deps = -r{toxinidir}/test-requirements.txt
[testenv:linters]
whitelist_externals = bash
commands = bash -c "find {toxinidir} \
commands =
bash -c "find {toxinidir} \
\( -name .tox -prune \) \
-o -type f -name '*.yaml' \
-print0 | xargs -0 yamllint"
{toxinidir}/tools/check_projects_yaml_alphabetized.sh
flake8
[testenv:venv]
commands = {posargs}