File tree 4 files changed +76
-0
lines changed
pipelines/templates/stages
4 files changed +76
-0
lines changed Original file line number Diff line number Diff line change @@ -208,3 +208,16 @@ stages:
208
208
--service="${{ parameters.ServiceDirectory }}"
209
209
--toxenv="next-pyright"
210
210
--disablecov
211
+
212
+ - task : PythonScript@0
213
+ displayName : ' Run Ruff'
214
+ continueOnError : true
215
+ inputs :
216
+ scriptPath : ' scripts/devops_tasks/setup_execute_tests.py'
217
+ arguments : >-
218
+ "azure*"
219
+ --mark_arg="${{ parameters.TestMarkArgument }}"
220
+ --service="${{ parameters.ServiceDirectory }}"
221
+ --toxenv="ruff"
222
+ --disablecov
223
+ env : ${{ parameters.EnvVars }}
Original file line number Diff line number Diff line change
1
+ # --------------------------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+ # --------------------------------------------------------------------------------------------
5
+
6
+ # This script is used to execute ruff within a tox environment.
7
+
8
+ import subprocess
9
+ import argparse
10
+ import os
11
+ import sys
12
+ from ci_tools .parsing import ParsedSetup
13
+
14
+
15
+ if __name__ == "__main__" :
16
+ parser = argparse .ArgumentParser (
17
+ description = "Run ruff against target folder."
18
+ )
19
+
20
+ parser .add_argument (
21
+ "-t" ,
22
+ "--target" ,
23
+ dest = "target_package" ,
24
+ help = "The target package directory on disk. The target module passed to ruff will be <target_package>/azure." ,
25
+ required = True ,
26
+ )
27
+
28
+ args = parser .parse_args ()
29
+
30
+ pkg_dir = os .path .abspath (args .target_package )
31
+ pkg_details = ParsedSetup .from_path (pkg_dir )
32
+ top_level_module = pkg_details .namespace .split ('.' )[0 ]
33
+
34
+ subprocess .check_call (
35
+ [
36
+ sys .executable ,
37
+ "-m" ,
38
+ "ruff" ,
39
+ "check" ,
40
+ os .path .join (args .target_package , top_level_module ),
41
+ ]
42
+ )
Original file line number Diff line number Diff line change @@ -117,6 +117,25 @@ commands =
117
117
--package-type sdist
118
118
python {repository_root}/eng/tox/run_pylint.py -t {tox_root} --next =True
119
119
120
+ [testenv:ruff]
121
+ description =Lints a package with ruff
122
+ skipsdist = true
123
+ skip_install = true
124
+ usedevelop = false
125
+ setenv =
126
+ {[testenv]setenv}
127
+ PROXY_URL =http://localhost:5022
128
+ deps =
129
+ {[base]deps}
130
+ ruff
131
+ commands =
132
+ python {repository_root}/eng/tox/create_package_and_install.py \
133
+ -d {envtmpdir}/dist \
134
+ -p {tox_root} \
135
+ -w {envtmpdir} \
136
+ --package-type sdist
137
+ python {repository_root}/eng/tox/run_ruff.py -t {tox_root}
138
+
120
139
[testenv:mypy]
121
140
description =Typechecks a package with mypy (version {[testenv:mypy]mypy_version})
122
141
mypy_version =1.0.0
Original file line number Diff line number Diff line change
1
+ line-length = 120
2
+ target-version = " py37"
You can’t perform that action at this time.
0 commit comments