check files license and format.
(check_license, repo, branch)
| 262 | default='master', |
| 263 | ) |
| 264 | def check(check_license, repo, branch): |
| 265 | """ |
| 266 | check files license and format. |
| 267 | """ |
| 268 | init_logger() |
| 269 | # get modified files list |
| 270 | checkout = CheckOut(repo, branch) |
| 271 | file_list = checkout.get_new_file() |
| 272 | if file_list is None: |
| 273 | logging.error("checkout files fail") |
| 274 | sys.exit(1) |
| 275 | |
| 276 | # check modified files format |
| 277 | format_check = FormatCheck(file_list) |
| 278 | format_check_result = format_check.check() |
| 279 | license_check_result = True |
| 280 | if check_license: |
| 281 | license_check = LicenseCheck(file_list) |
| 282 | license_check_result = license_check.check() |
| 283 | |
| 284 | if not format_check_result or not license_check_result: |
| 285 | logging.error("file format check or license check fail.") |
| 286 | sys.exit(1) |
| 287 | logging.info("check success.") |
| 288 | sys.exit(0) |
| 289 | |
| 290 | |
| 291 | if __name__ == '__main__': |
nothing calls this directly
no test coverage detected