MCPcopy
hub / github.com/pex-tool/pex / lint

Function lint

scripts/py27/lint_enum.py:113–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

111
112
113def lint():
114 # type: () -> Optional[str]
115
116 top = os.getcwd()
117 vendored = os.path.join(os.getcwd(), "pex", "vendor", "_vendored")
118 errors = [] # type: List[str]
119 for root, dirs, files in os.walk(top):
120 if root == top:
121 dirs[:] = [d for d in dirs if d in ("pex", "testing", "tests")]
122 else:
123 dirs[:] = [d for d in dirs if os.path.join(root, d) != vendored]
124
125 for f in files:
126 if f.endswith(".py"):
127 python_file = os.path.join(root, f)
128 for error in lint_enum(python_file):
129 errors.append(
130 "{file}: {error}".format(
131 file=os.path.relpath(python_file, top), error=error
132 )
133 )
134 if errors:
135 return cast(
136 str,
137 colors.red(
138 "Found {count} bad Enum {subclasses}:\n{errors}".format(
139 count=len(errors),
140 subclasses=pluralize(errors, "subclass"),
141 errors="\n".join(
142 "{index}. {error}".format(index=index, error=error)
143 for index, error in enumerate(errors, start=1)
144 ),
145 )
146 ),
147 )
148
149 return None
150
151
152def main():

Callers 1

mainFunction · 0.85

Calls 5

castFunction · 0.90
pluralizeFunction · 0.90
lint_enumFunction · 0.85
appendMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected