Update linting policy to enforce 120 char lines. (#1)

Also apply this requirement to all files.
This commit is contained in:
Bret Barkelew 2018-12-14 11:58:13 -08:00 коммит произвёл Sean Brogan
Родитель 1a52482264
Коммит ce5c17b652
4 изменённых файлов: 34 добавлений и 17 удалений

Просмотреть файл

@ -1,5 +1,5 @@
[flake8]
#E501 line too long
#E266 too many leading '#' for block comment
#E722 do not use bare 'except'
ignore = E501,E266,E722
ignore = E266,E722
max_line_length = 120

Просмотреть файл

@ -1,5 +1,6 @@
'''
Quick script to check that the wheel/package created is aligned on a git tag. Official releases should not be made from non-tagged code.
Quick script to check that the wheel/package created is aligned on a git tag.
Official releases should not be made from non-tagged code.
'''
import glob

Просмотреть файл

@ -179,7 +179,8 @@ def check_mu_confg(config, edk2path, pluginList):
config_type = str(type(config[rule]).__name__)
wanted_type = config_rules["required"][rule]["type"]
if config_type != wanted_type:
_mu_error("{0} is a required attribute and is not the correct type. We are expecting a {1} and got a {2}".format(rule, config_type, wanted_type))
_mu_error("{0} is a required attribute and is not the correct type. "
"We are expecting a {1} and got a {2}".format(rule, config_type, wanted_type))
if "validator" in config_rules["required"][rule]:
validator = config_rules["required"][rule]["validator"]
@ -194,7 +195,8 @@ def check_mu_confg(config, edk2path, pluginList):
config_type = str(type(config[rule]).__name__)
wanted_type = config_rules["optional"][rule]["type"]
if config_type != wanted_type:
_mu_error("{0} is a optional attribute and is not the correct type. We are expecting a {1} and got a {2}".format(rule, config_type, wanted_type))
_mu_error("{0} is a optional attribute and is not the correct type. "
"We are expecting a {1} and got a {2}".format(rule, config_type, wanted_type))
if "validator" in config_rules["optional"][rule]:
validator = config_rules["optional"][rule]["validator"]
@ -272,7 +274,8 @@ def check_package_confg(name, config, pluginList):
config_type = str(type(config[rule]).__name__)
wanted_type = config_rules["required"][rule]["type"]
if config_type != wanted_type:
_mu_error("{0} is a required attribute and is not the correct type. We are expecting a {1} and got a {2}".format(rule, config_type, wanted_type))
_mu_error("{0} is a required attribute and is not the correct type. "
"We are expecting a {1} and got a {2}".format(rule, config_type, wanted_type))
if "validator" in config_rules["required"][rule]:
validator = config_rules["required"][rule]["validator"]
@ -287,7 +290,8 @@ def check_package_confg(name, config, pluginList):
config_type = str(type(config[rule]).__name__)
wanted_type = config_rules["optional"][rule]["type"]
if config_type != wanted_type:
_mu_error("{0} is a optional attribute and is not the correct type. We are expecting a {1} and got a {2}".format(rule, config_type, wanted_type))
_mu_error("{0} is a optional attribute and is not the correct type. "
"We are expecting a {1} and got a {2}".format(rule, config_type, wanted_type))
if "validator" in config_rules["optional"][rule]:
validator = config_rules["optional"][rule]["validator"]

Просмотреть файл

@ -48,13 +48,22 @@ import pkg_resources
def get_mu_config():
parser = argparse.ArgumentParser(description='Run the Mu Build')
parser.add_argument('-c', '--mu_config', dest='mu_config', required=True, type=str, help='Provide the Mu config relative to the current working directory')
parser.add_argument('-p', '--pkg', '--pkg-dir', dest='pkglist', nargs="+", type=str, help='A package or folder you want to test (abs path or cwd relative). Can list multiple by doing -p <pkg1> <pkg2> <pkg3>', default=[])
parser.add_argument('-ignore', '--ignore-git', dest="git_ignore", action="store_true", help="Whether to ignore errors in the git cloing process", default=False)
parser.add_argument('-force', '--force-git', dest="git_force", action="store_true", help="Whether to force git repos to clone in the git cloing process", default=False)
parser.add_argument('-update-git', '--update-git', dest="git_update", action="store_true", help="Whether to update git repos as needed in the git cloing process", default=False)
parser.add_argument('-color', '--azure-color', dest="use_azure_color", action="store_true", help="Whether to use Azure color instead of ANSI color codes when printing to the terminal", default=False)
parser.add_argument('-nocolor', '--disable-color', dest="color_enabled", action="store_false", help="Whether to use disable all color outputs", default=True)
parser.add_argument('-c', '--mu_config', dest='mu_config', required=True, type=str,
help='Provide the Mu config relative to the current working directory')
parser.add_argument('-p', '--pkg', '--pkg-dir', dest='pkglist', nargs="+", type=str,
help='A package or folder you want to test (abs path or cwd relative). '
'Can list multiple by doing -p <pkg1> <pkg2> <pkg3>', default=[])
parser.add_argument('-ignore', '--ignore-git', dest="git_ignore", action="store_true",
help="Whether to ignore errors in the git cloing process", default=False)
parser.add_argument('-force', '--force-git', dest="git_force", action="store_true",
help="Whether to force git repos to clone in the git cloing process", default=False)
parser.add_argument('-update-git', '--update-git', dest="git_update", action="store_true",
help="Whether to update git repos as needed in the git cloing process", default=False)
parser.add_argument('-color', '--azure-color', dest="use_azure_color", action="store_true",
help="Whether to use Azure color instead of ANSI color codes when printing to the terminal",
default=False)
parser.add_argument('-nocolor', '--disable-color', dest="color_enabled", action="store_false",
help="Whether to use disable all color outputs", default=True)
args, sys.argv = parser.parse_known_args()
return args
@ -125,7 +134,9 @@ def main():
# Check Dependencies for Repo
if "Dependencies" in mu_config:
logging.log(MuLogging.SECTION, "Resolving Git Repos")
pplist.extend(RepoResolver.resolve_all(WORKSPACE_PATH, mu_config["Dependencies"], ignore=buildArgs.git_ignore, force=buildArgs.git_force, update_ok=buildArgs.git_update))
pplist.extend(RepoResolver.resolve_all(WORKSPACE_PATH, mu_config["Dependencies"],
ignore=buildArgs.git_ignore, force=buildArgs.git_force,
update_ok=buildArgs.git_update))
# make Edk2Path object to handle all path operations
edk2path = Edk2Path(WORKSPACE_PATH, pplist)
@ -270,8 +281,9 @@ def main():
# - Plugin Helper Obj Instance
# - testcase Object used for outputing junit results
# - output_stream the StringIO output stream from this plugin
rc = Descriptor.Obj.RunBuildPlugin(
pkgToRunOn, edk2path, sys.argv, mu_config, pkg_plugin_configuration, env, pluginManager, helper, tc, plugin_output_stream)
rc = Descriptor.Obj.RunBuildPlugin(pkgToRunOn, edk2path, sys.argv, mu_config,
pkg_plugin_configuration, env, pluginManager, helper,
tc, plugin_output_stream)
except Exception as exp:
exc_type, exc_value, exc_traceback = sys.exc_info()
logging.critical("EXCEPTION: {0}".format(exp))