How to use the xiblint.config.Config.filename function in xiblint

To help you get started, we’ve selected a few xiblint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lyft / xiblint / xiblint / __main__.py View on Github external
parser.add_argument("--reporter", choices=("raw", "json"),
                        default="raw",
                        help="custom reporter to use")
    parser.add_argument("paths", nargs=argparse.REMAINDER,
                        help="lint only at the specified paths")
    args = parser.parse_args()

    try:
        from xiblint.config import Config
        config = Config()
    except IOError as ex:
        print('Error: {}\n'.format(ex))
        parser.print_usage()
        sys.exit(1)
    except ValueError as ex:
        print('Error: {}: {}\n'.format(Config.filename, ex))
        parser.print_usage()
        sys.exit(1)

    #
    # Process paths
    #
    errors = []
    include_paths = args.paths or config.include_paths
    for path in include_paths:
        if os.path.isfile(path):
            errors += process_file(path, config)
        elif os.path.isdir(path):
            for root, _, files in os.walk(path):
                for filename in files:
                    if os.path.splitext(filename)[1].lower() in ('.storyboard', '.xib'):
                        file_path = os.path.join(root, filename)