##############################################################################
"""Scan documentation for bad practices."""
-__author__ = 'Thanh Ha'
+__author__ = "Thanh Ha"
import fnmatch
counter = 0
print("Scanning {}".format(filename))
- with open(filename, 'r') as _file:
+ with open(filename, "r") as _file:
for num, line in enumerate(_file, 1):
- if re.search('sudo pip', line):
+ if re.search("sudo pip", line):
counter += 1
- print('{}: {}'.format(num, line))
+ print("{}: {}".format(num, line))
if counter:
- print('ERROR: pip should never be used as a sudo command.')
- print('Consider one of the following solutions:')
- print('1. Use a virtualenv')
- print(' (https://virtualenv.pypa.io/en/stable/)')
- print('2. Use PEP370 instead via pip\'s --user parameter.')
- print(' (https://www.python.org/dev/peps/pep-0370/)')
+ print("ERROR: pip should never be used as a sudo command.")
+ print("Consider one of the following solutions:")
+ print("1. Use a virtualenv")
+ print(" (https://virtualenv.pypa.io/en/stable/)")
+ print("2. Use PEP370 instead via pip's --user parameter.")
+ print(" (https://www.python.org/dev/peps/pep-0370/)")
return True
return False
if __name__ == "__main__":
counter = 0
- for root, dirnames, filenames in os.walk('docs'):
- for filename in fnmatch.filter(filenames, '*.rst'):
+ for root, dirnames, filenames in os.walk("docs"):
+ for filename in fnmatch.filter(filenames, "*.rst"):
if check_sudo_pip(os.path.join(root, filename)):
counter += 1
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
-# Linux Foundation Release Engineering Tools documentation build configuration file, created by
-# sphinx-quickstart on Sat Mar 4 12:20:05 2017.
+# Linux Foundation Release Engineering Tools documentation build configuration
+# file, created by sphinx-quickstart on Sat Mar 4 12:20:05 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
-#
+"""Configuration file for Sphinx."""
-from docs_conf.conf import *
+from docs_conf.conf import * # noqa
-intersphinx_mapping['ansible'] = ('https://docs.ansible.com/ansible/latest/', None)
+intersphinx_mapping["ansible"] = ( # noqa
+ "https://docs.ansible.com/ansible/latest/",
+ None,
+)
linkcheck_ignore = [
- 'https://gerrit.linuxfoundation.org/infra/releng/docs-conf',
- 'https://gerrit.linuxfoundation.org/infra/#/settings/http-password',
- 'https://jenkins.acumos.org.*',
- 'https://build.automotivelinux.org.*',
- 'https://build.automotivelinux.org/sandbox',
- 'https://.*.example.org.*',
- 'https://git.opendaylight.org/gerrit/#/settings/gpg-keys',
- 'https://wiki.debian.org/meetbot', # SNI link needs Python 2.7.9+
- 'https://iotivity.biterg.io'
+ "https://gerrit.linuxfoundation.org/infra/releng/docs-conf",
+ "https://gerrit.linuxfoundation.org/infra/#/settings/http-password",
+ "https://jenkins.acumos.org.*",
+ "https://build.automotivelinux.org.*",
+ "https://build.automotivelinux.org/sandbox",
+ "https://.*.example.org.*",
+ "https://git.opendaylight.org/gerrit/#/settings/gpg-keys",
+ "https://wiki.debian.org/meetbot", # SNI link needs Python 2.7.9+
+ "https://iotivity.biterg.io",
]
-sphinx_tabs_valid_builders = ['linkcheck']
+sphinx_tabs_valid_builders = ["linkcheck"]
+
def setup(app):
+ """Injects the report issue ribbon."""
app.add_stylesheet("css/ribbon.css")