示例#1
0
文件: precommit.py 项目: iafisher/ish
def init(precommit):
    precommit.check(checks.NoStagedAndUnstagedChanges())
    precommit.check(checks.NoWhitespaceInFilePath())
    precommit.check(checks.DoNotSubmit())

    # Check Python format with black.
    precommit.check(checks.PythonFormat())

    # Lint Python code with flake8.
    precommit.check(checks.PythonLint())

    # Check the order of Python imports with isort.
    precommit.check(checks.PythonImportOrder())

    # Check that requirements.txt matches pip freeze.
    precommit.check(checks.PipFreeze(venv=".venv"))

    # Check Python static type annotations with mypy.
    # precommit.check(checks.PythonTypes())

    # Lint JavaScript code with ESLint.
    precommit.check(
        checks.JavaScriptLint(
            include=["*.ts"],
            exclude=["webpack.config.js"],
        ))
    precommit.check(checks.JavaScriptPrettierFormat(include=["*.ts"]))

    # Check Rust format with rustfmt.
    precommit.check(checks.RustFormat())
示例#2
0
def init(precommit):
    precommit.check(checks.NoStagedAndUnstagedChanges())
    precommit.check(checks.NoWhitespaceInFilePath())
    precommit.check(checks.DoNotSubmit())

    # Check Python format with black.
    precommit.check(checks.PythonFormat())

    # Lint Python code with flake8.
    precommit.check(checks.PythonLint())

    # Check the order of Python imports with isort.
    precommit.check(checks.PythonImportOrder())

    # Check that requirements.txt matches pip freeze.
    precommit.check(checks.PipFreeze(venv=".venv"))

    # Check Python static type annotations with mypy.
    # precommit.check(checks.PythonTypes())

    # Lint JavaScript code with ESLint.
    precommit.check(checks.JavaScriptLint())

    # Check Rust format with rustfmt.
    precommit.check(checks.RustFormat())

    # Run the test suite.
    precommit.check(checks.Command("UnitTests", ["./do", "test"]))
示例#3
0
def init(precommit):
    precommit.check(checks.NoStagedAndUnstagedChanges())
    precommit.check(checks.NoWhitespaceInFilePath())
    precommit.check(checks.DoNotSubmit())

    precommit.check(
        checks.Command("E2ETests", ["./t"],
                       slow=True,
                       exclude=["*.md", "precommit.py"]))
    precommit.check(checks.RustFormat())

    # Check Python format with black.
    precommit.check(checks.PythonFormat())

    # Lint Python code with flake8.
    precommit.check(checks.PythonLint())

    # Check the order of Python imports with isort.
    precommit.check(checks.PythonImportOrder())

    # Check Python static type annotations with mypy.
    # precommit.check(checks.PythonTypes())

    # Lint JavaScript code with ESLint.
    precommit.check(checks.JavaScriptLint())
示例#4
0
def init(precommit):
    precommit.check(checks.NoStagedAndUnstagedChanges())
    precommit.check(checks.NoWhitespaceInFilePath())
    precommit.check(checks.DoNotSubmit())

    pyinclude = ["test"]

    # Check Python format with black.
    precommit.check(checks.PythonFormat(include=pyinclude))

    # Lint Python code with flake8.
    precommit.check(checks.PythonLint(include=pyinclude))

    # Check the order of Python imports with isort.
    precommit.check(checks.PythonImportOrder(include=pyinclude))

    # Check that requirements.txt matches pip freeze.
    precommit.check(checks.PipFreeze(venv=".venv"))

    # Check Python static type annotations with mypy.
    # precommit.check(checks.PythonTypes())

    # Lint JavaScript code with ESLint.
    precommit.check(checks.JavaScriptLint())

    # Check Rust format with rustfmt.
    precommit.check(checks.RustFormat())

    # Run a custom command.
    # precommit.check(checks.Command("UnitTests", ["./test"]))

    # Run a custom command on each file.
    # precommit.check(checks.Command("FileCheck", ["check_file"], pass_files=True))

    precommit.check(checks.Command("UnitTests", ["./test"]))
示例#5
0
def init(precommit):
    # Generic checks
    precommit.check(checks.NoStagedAndUnstagedChanges())
    precommit.check(checks.NoWhitespaceInFilePath())
    precommit.check(checks.DoNotSubmit())

    # Language-specific checks
    precommit.check(checks.PythonFormat())
    precommit.check(checks.PythonLint(args=["--extend-ignore=E731"]))
    precommit.check(checks.PythonTypes(exclude=["precommit.py"]))

    precommit.check(checks.Command("UnitTests", ["python3", "oeuvre_test.py"]))
示例#6
0
def init(precommit):
    precommit.check(checks.NoStagedAndUnstagedChanges())
    precommit.check(checks.NoWhitespaceInFilePath())
    precommit.check(checks.DoNotSubmit())

    # Check Python format with black.
    precommit.check(checks.PythonFormat())

    # Lint Python code with flake8.
    precommit.check(checks.PythonLint())

    # Check the order of Python imports with isort.
    precommit.check(checks.PythonImportOrder())

    # Check that requirements.txt matches pip freeze.
    precommit.check(checks.PipFreeze(venv=".venv"))

    # Run unit tests.
    precommit.check(checks.Command("UnitTests", ["./do", "test"], exclude=["*.md"]))