How to use the gdtoolkit.linter.DEFAULT_CONFIG.copy function in gdtoolkit

To help you get started, we’ve selected a few gdtoolkit 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 Scony / godot-gdscript-toolkit / tests / linter / common.py View on Github external
def simple_ok_check(code, **kwargs):
    extra_disable = [] if "disable" not in kwargs else kwargs["disable"]
    config = DEFAULT_CONFIG.copy()
    config.update({"disable": extra_disable})
    outcome = lint_code(code, config)
    assert len(outcome) == 0, outcome
github Scony / godot-gdscript-toolkit / tests / linter / common.py View on Github external
def simple_nok_check(code, check_name, line=2, **kwargs):
    extra_disable = [] if "disable" not in kwargs else kwargs["disable"]
    config_w_disable = DEFAULT_CONFIG.copy()
    config_w_disable.update({"disable": [check_name] + extra_disable})
    assert len(lint_code(code, config_w_disable)) == 0

    config = DEFAULT_CONFIG.copy()
    config.update({"disable": extra_disable})
    outcome = lint_code(code, config)
    assert len(outcome) == 1
    assert outcome[0].name == check_name
    assert outcome[0].line == line
github Scony / godot-gdscript-toolkit / tests / linter / common.py View on Github external
def simple_nok_check(code, check_name, line=2, **kwargs):
    extra_disable = [] if "disable" not in kwargs else kwargs["disable"]
    config_w_disable = DEFAULT_CONFIG.copy()
    config_w_disable.update({"disable": [check_name] + extra_disable})
    assert len(lint_code(code, config_w_disable)) == 0

    config = DEFAULT_CONFIG.copy()
    config.update({"disable": extra_disable})
    outcome = lint_code(code, config)
    assert len(outcome) == 1
    assert outcome[0].name == check_name
    assert outcome[0].line == line
github Scony / godot-gdscript-toolkit / gdtoolkit / linter / __main__.py View on Github external
arguments = docopt(
        __doc__,
        version="gdlint {}".format(pkg_resources.get_distribution("gdtoolkit").version),
    )

    if not isinstance(arguments, dict):
        print(arguments)  # stderr
        sys.exit(0)

    if arguments["--verbose"]:
        logging.basicConfig(stream=sys.stdout, level=logging.INFO)

    if arguments["--dump-default-config"]:  # TODO: error handling
        assert not os.path.isfile(CONFIG_FILE_NAME)
        with open(CONFIG_FILE_NAME, "w") as fh:
            fh.write(yaml.dump(DEFAULT_CONFIG.copy()))
        sys.exit(0)

    # TODO: add opt-based config-file providing
    # TODO: extract the algorithm
    search_dir = Path(os.getcwd())
    found_config_file_path = None
    while search_dir != Path(os.path.abspath(os.sep)):
        file_path = os.path.join(search_dir, CONFIG_FILE_NAME)
        if os.path.isfile(file_path):
            found_config_file_path = file_path
            break
        file_path = os.path.join(search_dir, ".{}".format(CONFIG_FILE_NAME))
        if os.path.isfile(file_path):
            found_config_file_path = file_path
            break
        search_dir = search_dir.parent