File: .pre-commit-config.yaml

package info (click to toggle)
python-azure 20250603%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 851,724 kB
  • sloc: python: 7,362,925; ansic: 804; javascript: 287; makefile: 195; sh: 145; xml: 109
file content (69 lines) | stat: -rw-r--r-- 2,285 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
files: sdk/ml/
repos:
-   repo: https://github.com/psf/black
    rev: 24.4.0 # Needs to be updated whenever azure sdk team bumps
    hooks:
    -   id: black
        args: [--config=eng/black-pyproject.toml]
- repo: https://github.com/streetsidesoftware/cspell-cli
  rev: v6.31.0
  hooks:
  - id: cspell
    args: ['--config', '.vscode/cspell.json', "--no-must-find-files"]
- repo: https://github.com/PyCQA/isort
  rev: 5.13.2
  hooks:
  - id: isort
    name: isort (python)
    args: ['--settings-file', 'sdk/ml/azure-ai-ml/pyproject.toml']
- repo: local
  hooks:
    - id: pylint-dependencies-check
      name: pylint-dependencies-check
      entry: python
      language: system
      types: [python]
      args:
      - "-c"
      - |
        import os
        import sys

        import pkg_resources

        # These are the versions that run in our CI
        dependencies = [
            (
                "azure-pylint-guidelines-checker",
                "0.5.6",
                [
                    "--index-url",
                    "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/",
                ],
            ),
            ("pylint", "3.2.7", []),
        ]

        # Make sure that correct versions are installed
        for packagename, required_version, install_args in dependencies:
            try:
                version = pkg_resources.get_distribution(packagename).version
                assert version == required_version
            except AssertionError:
                print(
                    f"Version mismatch: Installed version '{version}' of '{packagename}' does not match required version {required_version}"
                )
            except pkg_resources.DistributionNotFound:
                print(f"Package '{packagename}' is not installed")
            else:
                continue

            print(f"Please run the following command to install the correct version of {packagename}")
            print(f"\tpython -m pip install {packagename}=={required_version} {' '.join(install_args)}")
            sys.exit(1)
    - id: pylint
      name: pylint
      entry: python
      language: system
      args: [ -m, pylint, --rcfile=pylintrc, --output-format=parseable ]
      types: [python]