File tree Expand file tree Collapse file tree 6 files changed +46
-190
lines changed
sklearn/decomposition/tests Expand file tree Collapse file tree 6 files changed +46
-190
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,3 @@ doc-noplot: inplace
63
63
code-analysis :
64
64
flake8 sklearn | grep -v __init__ | grep -v external
65
65
pylint -E -i y sklearn/ -d E1103,E0611,E1101
66
-
67
- flake8-diff :
68
- git diff upstream/main -u -- " *.py" | flake8 --diff
Original file line number Diff line number Diff line change 40
40
black --check --diff .
41
41
displayName: Run black
42
42
- bash : |
43
- ./build_tools/circle /linting.sh
43
+ ./build_tools/azure /linting.sh
44
44
displayName: Run linting
45
45
- bash : |
46
46
mypy sklearn/
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+ # pipefail is necessary to propagate exit codes
5
+ set -o pipefail
6
+
7
+ flake8 --show-source .
8
+ echo -e " No problem detected by flake8\n"
9
+
10
+ # For docstrings and warnings of deprecated attributes to be rendered
11
+ # properly, the property decorator must come before the deprecated decorator
12
+ # (else they are treated as functions)
13
+
14
+ # do not error when grep -B1 "@property" finds nothing
15
+ set +e
16
+ bad_deprecation_property_order=` git grep -A 10 " @property" -- " *.py" | awk ' /@property/,/def /' | grep -B1 " @deprecated" `
17
+
18
+ if [ ! -z " $bad_deprecation_property_order " ]
19
+ then
20
+ echo " property decorator should come before deprecated decorator"
21
+ echo " found the following occurrencies:"
22
+ echo $bad_deprecation_property_order
23
+ exit 1
24
+ fi
25
+
26
+ # Check for default doctest directives ELLIPSIS and NORMALIZE_WHITESPACE
27
+
28
+ doctest_directive=" $( git grep -nw -E " # doctest\: \+(ELLIPSIS|NORMALIZE_WHITESPACE)" ) "
29
+
30
+ if [ ! -z " $doctest_directive " ]
31
+ then
32
+ echo " ELLIPSIS and NORMALIZE_WHITESPACE doctest directives are enabled by default, but were found in:"
33
+ echo " $doctest_directive "
34
+ exit 1
35
+ fi
36
+
37
+ joblib_import=" $( git grep -l -A 10 -E " joblib import.+delayed" -- " *.py" " :!sklearn/utils/_joblib.py" " :!sklearn/utils/fixes.py" ) "
38
+
39
+ if [ ! -z " $joblib_import " ]; then
40
+ echo " Use from sklearn.utils.fixes import delayed instead of joblib delayed. The following files contains imports to joblib.delayed:"
41
+ echo " $joblib_import "
42
+ exit 1
43
+ fi
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -435,15 +435,11 @@ complies with the following rules before marking a PR as ``[MRG]``. The
435
435
`editor integration documentation <https://black.readthedocs.io/en/stable/integrations/editors.html >`_
436
436
to configure your editor to run `black `.
437
437
438
- 6. **Make sure that your PR does not add PEP8 violations **. To check the
439
- code that you changed, you can run the following command (see
440
- :ref: `above <upstream >` to set up the ``upstream `` remote):
438
+ 6. Run `flake8 ` to make sure you followed the project coding conventions.
441
439
442
440
.. prompt :: bash $
443
441
444
- git diff upstream/main -u -- "*.py" | flake8 --diff
445
-
446
- or `make flake8-diff ` which should work on Unix-like systems.
442
+ flake8 .
447
443
448
444
7. Follow the :ref: `coding-guidelines `.
449
445
Original file line number Diff line number Diff line change @@ -54,7 +54,6 @@ def test_parameter_checking():
54
54
# automatically tested in the common tests.
55
55
56
56
A = np .ones ((2 , 2 ))
57
- name = "spam"
58
57
59
58
msg = "Invalid beta_loss parameter: solver 'cd' does not handle beta_loss = 1.0"
60
59
with pytest .raises (ValueError , match = msg ):
You can’t perform that action at this time.
0 commit comments