Ejemplo n.º 1
0
                        help="""Style checkers to run. Can be specified
                        multiple times.""")

    parser.add_argument("files", metavar="FILE", nargs="*",
                        type=str,
                        help="Source file(s) to inspect")

    args = parser.parse_args()

    repo = repo_types[args.repo_type]()

    verifiers = [ verifier_names[name] for name in args.checker ] \
                if args.checker else None

    files = args.files
    if not files and repo:
        added, modified = repo.staged_files()
        files = [ repo.file_path(f) for f in added + modified ]

    for filename in files:
        if args.modifications and repo and repo.in_repo(filename):
            regions = repo.modified_regions(filename)
        else:
            regions = all_regions

        if not verify(filename, regions=regions,
                      verbose=args.verbose,
                      verifiers=verifiers,
                      auto_fix=args.fix):
            sys.exit(1)
Ejemplo n.º 2
0
                        help="""Style checkers to run. Can be specified
                        multiple times.""")

    parser.add_argument("files", metavar="FILE", nargs="*",
                        type=str,
                        help="Source file(s) to inspect")

    args = parser.parse_args()

    repo = repo_types[args.repo_type]()

    verifiers = [ verifier_names[name] for name in args.checker ] \
                if args.checker else None

    files = args.files
    if not files and repo:
        added, modified = repo.staged_files()
        files = [ repo.file_path(f) for f in added + modified ]

    for filename in files:
        if args.modifications and repo and repo.in_repo(filename):
            regions = repo.modified_regions(filename)
        else:
            regions = all_regions

        if not verify(filename, regions=regions,
                      verbose=args.verbose,
                      verifiers=verifiers,
                      auto_fix=args.fix):
            sys.exit(1)