Duck type version of AffectedFile needed to check files under directories where a DEPS file changed. Extend the interface along the line of AffectedFile if you need it for other checks.
| 218 | return result |
| 219 | |
| 220 | class ImpactedFile(object): |
| 221 | """Duck type version of AffectedFile needed to check files under directories |
| 222 | where a DEPS file changed. Extend the interface along the line of |
| 223 | AffectedFile if you need it for other checks.""" |
| 224 | |
| 225 | def __init__(self, path): |
| 226 | self._path = path |
| 227 | |
| 228 | def LocalPath(self): |
| 229 | path = self._path.replace(os.sep, '/') |
| 230 | return os.path.normpath(path) |
| 231 | |
| 232 | def ChangedContents(self): |
| 233 | with open(self._path) as f: |
| 234 | # TODO(liviurau): read only '#include' lines |
| 235 | lines = f.readlines() |
| 236 | return enumerate(lines, start=1) |
| 237 | |
| 238 | def _FilterDuplicates(impacted_files, affected_files): |
| 239 | """"We include all impacted files but exclude affected files that are also |
no outgoing calls
no test coverage detected
searching dependent graphs…