Skip to content

CI: Linting with azure instead of travis #22854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 120 commits into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
46620f2
Moving one-line linting and checks from lint.sh to azure steps
datapythonista Sep 27, 2018
dc8c528
Moving everything from lint.sh to azure (so far repeating the command…
datapythonista Sep 27, 2018
adeb0ca
Fixing continueOnError settings
datapythonista Sep 27, 2018
dcfb203
Reverting the exit status of the grep commands, we want them to fail …
datapythonista Sep 27, 2018
b765df8
Testing the continueOnError, doesn't seem to be working at job level,…
datapythonista Sep 27, 2018
3c77fc9
Escaping exclamation marks to reverse the exist status of grep, azure…
datapythonista Sep 27, 2018
3d8af7d
Adding the continueOnError to every step, and trying if bash instead …
datapythonista Sep 27, 2018
ed1064d
Fixes to missing continueOnError, and to the grep command exit status
datapythonista Sep 27, 2018
8cb7b0f
Testing couple of ways to invert the exit status of grep
datapythonista Sep 27, 2018
dee5a08
Fixing azure config syntax error
datapythonista Sep 27, 2018
54f9e98
Fixing the checks (they should be ok now), and adding an intentional …
datapythonista Sep 27, 2018
20cb360
Removing intentional pep8 issue, and fixing last known problems
datapythonista Sep 27, 2018
50d2757
fixing style of azure settings
datapythonista Sep 27, 2018
19a213c
Replacing continueOnError (that converts errors in warnings) to condi…
datapythonista Sep 29, 2018
0cf5da9
Fixing multiline in yaml, and removing job level continueOnError
datapythonista Sep 29, 2018
4d10702
Changing the format of flake8 output to azure (so it creates links, a…
datapythonista Sep 30, 2018
a356f03
Removing unnecessary quotes in flake8 format config
datapythonista Sep 30, 2018
50cb867
flake8 format breaks pip (ConfigParser) when present in setup.cfg, mo…
datapythonista Sep 30, 2018
091193c
Adding azure formatting to all failing flake8
datapythonista Sep 30, 2018
4a2ddba
Merging from master
datapythonista Oct 10, 2018
e7c276a
Fixing azure job name
datapythonista Oct 10, 2018
8f73c08
Making the format look good for flake8 and patterns, and adding file …
datapythonista Oct 12, 2018
87b5048
Trying if environment variables can be defined in the script setting
datapythonista Oct 12, 2018
dc2e3a6
Merging from master
datapythonista Nov 4, 2018
5ab03ab
Removing file with errors to be displayed, and comment in the setup.cfg
datapythonista Nov 4, 2018
ca9e12a
Changing cython cast grep to invgrep
datapythonista Nov 4, 2018
c591a17
Merging from master
datapythonista Nov 9, 2018
c671da5
Building source of the checks build and moving the documentation buil…
datapythonista Nov 9, 2018
a6eed3e
Adding dependencies file for the checks and doc build
datapythonista Nov 9, 2018
3b853f9
Renaming conda yaml env variable
datapythonista Nov 9, 2018
850202d
Fixing env variables to set up conda
datapythonista Nov 9, 2018
a896532
Debugging why azure is not installing desired dependencies
datapythonista Nov 9, 2018
bed55be
Fixing once more env variables
datapythonista Nov 9, 2018
e555ce0
Fixing indentation in dependencies file
datapythonista Nov 9, 2018
101f7f3
Adding missing env variables and dependencies
datapythonista Nov 10, 2018
fce22e6
Fixing unset env variables for the doc build
datapythonista Nov 10, 2018
167f6dc
Fixing directory for the doc build script
datapythonista Nov 10, 2018
d44f189
WIP: Testing a simpler way to build and upload the documentation
datapythonista Nov 10, 2018
906da22
Printing installed dependencies in checks job (temporary, to debug py…
datapythonista Nov 10, 2018
9fb3999
Printing installed dependencies in azure, for debugging
datapythonista Nov 11, 2018
c72c0e5
Fixing bug when uploading the docs to github pages
datapythonista Nov 11, 2018
de1f52f
Adding an extra error to the validation of docstrings, as it's been f…
datapythonista Nov 11, 2018
e4aa371
Adding new docstring error code to the validation, and tests with the…
datapythonista Nov 11, 2018
f33b6e6
Merging from master
datapythonista Nov 12, 2018
63cfd5b
Generating the script of the deps check in azure format
datapythonista Nov 12, 2018
eb558df
Publishing docs with azure artifacts instead of github pages, and add…
datapythonista Nov 12, 2018
371f06e
Removing unnecessary checks on travis on whether the doc is being bui…
datapythonista Nov 13, 2018
ca6e910
Merge remote-tracking branch 'upstream/master' into azure_lint
datapythonista Nov 13, 2018
d262a04
Debugging why pyqt is not being installed
datapythonista Nov 13, 2018
fc4574c
Merge remote-tracking branch 'upstream/master' into azure_lint
datapythonista Nov 13, 2018
168ec55
Adding section names check to validate docstrings, now that all wrong…
datapythonista Nov 13, 2018
2f1b270
Fixing conda install pyqt for debugging
datapythonista Nov 13, 2018
798698d
Merging from master
datapythonista Nov 19, 2018
a3f601c
Using github pages to publish the documentation
datapythonista Nov 19, 2018
5ea21c6
Testing if linux variables can be defined once for the whole job
datapythonista Nov 19, 2018
46d281c
Using env for the environment variables, and implemented azure storag…
datapythonista Nov 19, 2018
faf49e9
Fixing typo
datapythonista Nov 19, 2018
fa4f16c
Setting environment variables at the beginning of the job, and adding…
datapythonista Nov 19, 2018
c05f6b7
Fixing /home/mgarcia/miniconda3/envs/pandas-dev/bin:/home/mgarcia/min…
datapythonista Nov 19, 2018
9162aeb
Fixed typo in PATH
datapythonista Nov 19, 2018
5640907
Formatting flake8-rst output for azure
datapythonista Nov 19, 2018
0286099
Merge remote-tracking branch 'upstream/master' into azure_lint
datapythonista Nov 20, 2018
629a209
Updating azure connection string
datapythonista Nov 20, 2018
588d153
Checking if environment.yml can be used for the docs and checks build…
datapythonista Nov 20, 2018
bc9c3b3
Remove unused stuff from azure config
datapythonista Nov 20, 2018
324b1e2
Doing checks as soon as possible (before conda, before build)
datapythonista Nov 20, 2018
5bf1709
Fixing build errors (typo in dependencies, missing cpplint, code chec…
datapythonista Nov 20, 2018
7cf2d68
Addapting generate_pip_deps_from_conda.py to support pip dependencies…
datapythonista Nov 20, 2018
2f8441e
Setting DISPLAY env to see if that fixes the to_clipboard problem
datapythonista Nov 20, 2018
30ba23e
Consistent way to source the conda environment
datapythonista Nov 20, 2018
85172b3
Fixing typo in environment name, and removing pyqt debug info
datapythonista Nov 20, 2018
450f84a
Adding checkpoints to see where the docstests change the exit status
datapythonista Nov 20, 2018
7b4b1ea
Restoring required html5lib dependency
datapythonista Nov 20, 2018
5d69e8b
Removing travis doc job
datapythonista Nov 20, 2018
3ce1aa0
Removing linting comments, and token for the docs from travis
datapythonista Nov 20, 2018
ee01df4
removing checkpoints and increasing verbosity of failing doctests
datapythonista Nov 20, 2018
e353e8a
Restoring bf4 in travis deps, as it's required, and fixing the to_cli…
datapythonista Nov 21, 2018
92a3921
Moving scripts unit tests to azure
datapythonista Nov 21, 2018
9e34037
Adding conda environment to run scripts tests, and changing verbosity…
datapythonista Nov 21, 2018
5a82f59
Using connection string secret variable instead of composing it in th…
datapythonista Nov 21, 2018
6cbb31b
Adding benchmark run to the CI
datapythonista Nov 22, 2018
2617696
Merge remote-tracking branch 'upstream/master' into azure_lint
datapythonista Nov 22, 2018
75ad473
Adding git remote for the benchmarks, and removing connection string …
datapythonista Nov 22, 2018
7af04e1
Providing azure storage info as arguments instead of env, and fetchin…
datapythonista Nov 22, 2018
cc4331c
Trying to fix benchmarks and azure storage issues
datapythonista Nov 22, 2018
c5df401
Testing if azure storage key has a missing =, and setting up machine …
datapythonista Nov 22, 2018
4eac8bb
More changes to the doc upload and the benchmarks, to try to make the…
datapythonista Nov 22, 2018
00032d1
More fixes to doc upload and benchmarks
datapythonista Nov 22, 2018
e9ab754
Adding debug info for the docs upload and the benchmarks
datapythonista Nov 22, 2018
e47b4e1
Fixing bug in benchmarks set up, and fixing docstring errors, so vali…
datapythonista Nov 22, 2018
d0d4ae1
Merge remote-tracking branch 'upstream/master' into azure_lint
datapythonista Nov 23, 2018
a225d44
Clean up of debug info
datapythonista Nov 23, 2018
d6d5c66
Uploading docs to GitHub pages in the same way as travis
datapythonista Nov 23, 2018
f7a6048
Adding variable group to the job config, to see if that makes them ac…
datapythonista Nov 23, 2018
9aa18d0
WIP: Restoring travis documentation build
datapythonista Nov 23, 2018
283233d
Restoing documentation build in travis
datapythonista Nov 23, 2018
991304d
Removing variable group, as variables are not in a group anymore, and…
datapythonista Nov 27, 2018
3a71185
Merge remote-tracking branch 'upstream/master' into azure_lint
datapythonista Nov 27, 2018
19c396f
Adding missing conda environment activation
datapythonista Nov 27, 2018
a69e667
Fixing docstring errors
datapythonista Nov 27, 2018
59d55d8
Removing documentation build from azure
datapythonista Nov 28, 2018
df50c58
Merge remote-tracking branch 'upstream/master' into azure_lint
datapythonista Nov 28, 2018
455e77c
Adding debug info to diagnose /home/mgarcia/miniconda3/bin:/home/mgar…
datapythonista Nov 28, 2018
7f48ac2
adding more debug information
datapythonista Nov 28, 2018
078a987
Revert "Removing documentation build from azure"
datapythonista Nov 28, 2018
d7883a1
Clean up of debug commands
datapythonista Nov 28, 2018
c2be491
Removing doc build in azure (restored because of the path problem)
datapythonista Nov 28, 2018
910825a
Building docs in azure, and uploading them to azure storage if it's a…
datapythonista Nov 29, 2018
35c7d99
Merge remote-tracking branch 'upstream/master' into azure_lint
datapythonista Nov 30, 2018
d321a42
Merging from master
datapythonista Nov 30, 2018
4328b04
Fixing pending docstrings
datapythonista Dec 1, 2018
4c57f48
Updating dependencies with the version that fixes the speed problems
datapythonista Dec 1, 2018
497f032
Updating pip requirements
datapythonista Dec 1, 2018
c88911a
Always uploading docs (removed if to test if uploading the docs work …
datapythonista Dec 1, 2018
75b89eb
Adding parallelization to build and docs
datapythonista Dec 1, 2018
011950e
Removing documentation build in azure, and reverting using more than …
datapythonista Dec 1, 2018
01942b9
Made an invgrep a newly added pattern validation
datapythonista Dec 1, 2018
0a14165
Merging from master
datapythonista Dec 1, 2018
705eb9d
Regenerating pip dependencies
datapythonista Dec 1, 2018
498cebb
Merging from master
datapythonista Dec 2, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,58 @@ jobs:
parameters:
name: WindowsPy27
vmImage: vs2017-win2017

- job: 'Linting'
pool:
vmImage: ubuntu-16.04
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
architecture: 'x64'
# We're ignoring the following codes across the board
#E402, # module level import not at top of file
#E731, # do not assign a lambda expression, use a def
#E741, # do not use variables named 'l', 'O', or 'I'
#W503, # line break before binary operator
#C406, # Unnecessary (list/tuple) literal - rewrite as a dict literal.
#C408, # Unnecessary (dict/list/tuple) call - rewrite as a literal.
#C409, # Unnecessary (list/tuple) passed to tuple() - (remove the outer call to tuple()/rewrite as a tuple literal).
#C410 # Unnecessary (list/tuple) passed to list() - (remove the outer call to list()/rewrite as a list literal).

# pandas/_libs/src is C code, so no need to search there.
- script: flake8 pandas --filename=*.py --exclude pandas/_libs/src --ignore=C406,C408,C409,E402,E731,E741,W503
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this --ignore necessary? I would think that this would be picked up from our setup.cfg. Better to delete it here so that we don't have to update two places.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. That was in the original lint.sh, but will check if the setting in setup.cfg is used.

displayName: 'Linting *.py code'
- script: flake8 pandas --filename=*.pyx --select=E501,E302,E203,E111,E114,E221,E303,E128,E231,E126,E265,E305,E301,E127,E261,E271,E129,W291,E222,E241,E123,F403,C400,C401,C402,C403,C404,C405,C406,C407,C408,C409,C410,C411
displayName: 'Linting *.pyx code'
- script: cpplint --quiet --extensions=c,h --headers=h --filter=-readability/casting,-runtime/int,-build/include_subdir --recursive pandas/_libs/tslibs/src/datetime
displayName: 'Linting pandas/_libs/tslibs/src/datetime'
- script: flake8 setup.py --ignore=E402,E731,E741,W503
displayName: 'Linting setup.py'
- script: flake8 scripts --filename=*.py --ignore=C408,E402,E731,E741,W503
displayName: 'Linting scripts'
# TODO I think flake8 the scripts directory already checks the scripts/tests
# will remove later
- script: flake8 scripts/tests --filename=*.py
displayName: 'Linting scripts tests'
- script: flake8 asv_bench/benchmarks/ --exclude=asv_bench/benchmarks/*.py --ignore=F811,C406,C408,C409,C410
displayName: 'Linting asv benchmarks'
- script: flake8 doc/make.py doc/source/conf.py --ignore=E402,E731,E741,W503
displayName: 'Linting doc scripts'
# Check for imports from pandas.core.common instead of `import pandas.core.common as com`
- script: grep -R --include="*.py*" -E "from pandas.core.common import " pandas
displayName: 'Check for non-standard imports'
- script: grep -r -E --include '*.py' 'pytest\.warns' pandas/tests/
displayName: 'Check for pytest warns'
# Check for the following code in testing: `np.testing` and `np.array_equal`
- script: grep -r -E --include '*.py' --exclude testing.py '(numpy|np)(\.testing|\.array_equal)' pandas/tests/
displayName: 'Check for invalid testing'
# Check for the following code in the extension array base tests: `tm.assert_frame_equal` and `tm.assert_series_equal`
- script: grep -r -E --include '*.py' --exclude base.py 'tm.assert_(series|frame)_equal' pandas/tests/extension/base
displayName: 'Check for invalid EA testing'
- script: grep -R --include="*.py" --include="*.pyx" -E "(DEPRECATED|DEPRECATE|Deprecated)(:|,|\.)" pandas
displayName: 'Check for deprecated messages without sphinx directive'
- script: grep -R --include="*.py" -E "class\s\S*[^)]:" pandas scripts
displayName: 'Check for old-style classes'
- script: grep -R --include="*.rst" -E "[a-zA-Z0-9]\`\`?[a-zA-Z0-9]" doc/source/
displayName: 'Check for backticks incorrectly rendering because of missing spaces'
118 changes: 0 additions & 118 deletions ci/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,6 @@ if [ "$LINT" ]; then
#C409, # Unnecessary (list/tuple) passed to tuple() - (remove the outer call to tuple()/rewrite as a tuple literal).
#C410 # Unnecessary (list/tuple) passed to list() - (remove the outer call to list()/rewrite as a list literal).

# pandas/_libs/src is C code, so no need to search there.
echo "Linting *.py"
flake8 pandas --filename=*.py --exclude pandas/_libs/src --ignore=C406,C408,C409,E402,E731,E741,W503
if [ $? -ne "0" ]; then
RET=1
fi

flake8 scripts/tests --filename=*.py
if [ $? -ne "0" ]; then
RET=1
fi
echo "Linting *.py DONE"

echo "Linting setup.py"
flake8 setup.py --ignore=E402,E731,E741,W503
if [ $? -ne "0" ]; then
RET=1
fi
echo "Linting setup.py DONE"

echo "Linting asv_bench/benchmarks/"
flake8 asv_bench/benchmarks/ --exclude=asv_bench/benchmarks/*.py --ignore=F811,C406,C408,C409,C410
if [ $? -ne "0" ]; then
RET=1
fi
echo "Linting asv_bench/benchmarks/*.py DONE"

echo "Linting scripts/*.py"
flake8 scripts --filename=*.py --ignore=C408,E402,E731,E741,W503
if [ $? -ne "0" ]; then
RET=1
fi
echo "Linting scripts/*.py DONE"

echo "Linting doc scripts"
flake8 doc/make.py doc/source/conf.py --ignore=E402,E731,E741,W503
if [ $? -ne "0" ]; then
RET=1
fi
echo "Linting doc scripts DONE"

echo "Linting *.pyx"
flake8 pandas --filename=*.pyx --select=E501,E302,E203,E111,E114,E221,E303,E128,E231,E126,E265,E305,E301,E127,E261,E271,E129,W291,E222,E241,E123,F403,C400,C401,C402,C403,C404,C405,C406,C407,C408,C409,C410,C411
if [ $? -ne "0" ]; then
RET=1
fi
echo "Linting *.pyx DONE"

echo "Linting *.pxi.in"
for path in 'src'
do
Expand Down Expand Up @@ -105,51 +57,6 @@ if [ "$LINT" ]; then
RET=1
fi
done
echo "linting -> pandas/_libs/tslibs/src/datetime"
cpplint --quiet --extensions=c,h --headers=h --filter=-readability/casting,-runtime/int,-build/include_subdir --recursive pandas/_libs/tslibs/src/datetime
if [ $? -ne "0" ]; then
RET=1
fi
echo "Linting *.c and *.h DONE"

echo "Check for invalid testing"

# Check for the following code in testing:
#
# np.testing
# np.array_equal
grep -r -E --include '*.py' --exclude testing.py '(numpy|np)(\.testing|\.array_equal)' pandas/tests/

if [ $? = "0" ]; then
RET=1
fi

# Check for pytest.warns
grep -r -E --include '*.py' 'pytest\.warns' pandas/tests/

if [ $? = "0" ]; then
RET=1
fi

# Check for the following code in the extension array base tests
# tm.assert_frame_equal
# tm.assert_series_equal
grep -r -E --include '*.py' --exclude base.py 'tm.assert_(series|frame)_equal' pandas/tests/extension/base

if [ $? = "0" ]; then
RET=1
fi

echo "Check for invalid testing DONE"

# Check for imports from pandas.core.common instead
# of `import pandas.core.common as com`
echo "Check for non-standard imports"
grep -R --include="*.py*" -E "from pandas.core.common import " pandas
if [ $? = "0" ]; then
RET=1
fi
echo "Check for non-standard imports DONE"

echo "Check for incorrect sphinx directives"
SPHINX_DIRECTIVES=$(echo \
Expand All @@ -164,31 +71,6 @@ if [ "$LINT" ]; then
fi
done
echo "Check for incorrect sphinx directives DONE"

echo "Check for deprecated messages without sphinx directive"
grep -R --include="*.py" --include="*.pyx" -E "(DEPRECATED|DEPRECATE|Deprecated)(:|,|\.)" pandas

if [ $? = "0" ]; then
RET=1
fi
echo "Check for deprecated messages without sphinx directive DONE"

echo "Check for old-style classes"
grep -R --include="*.py" -E "class\s\S*[^)]:" pandas scripts

if [ $? = "0" ]; then
RET=1
fi
echo "Check for old-style classes DONE"

echo "Check for backticks incorrectly rendering because of missing spaces"
grep -R --include="*.rst" -E "[a-zA-Z0-9]\`\`?[a-zA-Z0-9]" doc/source/

if [ $? = "0" ]; then
RET=1
fi
echo "Check for backticks incorrectly rendering because of missing spaces DONE"

else
echo "NOT Linting"
fi
Expand Down