Skip to content

Commit

Permalink
Add configuration for flake8 to setup.cfg (piskvorky#1636)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcobzarenco authored and horpto committed Oct 28, 2017
1 parent 7d6a975 commit cb081db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions continuous_integration/travis/flake8_diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set -o pipefail

PROJECT=RaRe-Technologies/gensim
PROJECT_URL=https://github.com/${PROJECT}.git
FLAKE_CONFIG_FILE=setup.cfg

# Find the remote with the project name (upstream in most cases)
REMOTE=$(git remote -v | grep ${PROJECT} | cut -f1 | head -1 || echo '')
Expand Down Expand Up @@ -133,14 +134,14 @@ check_files() {
if [ -n "$files" ]; then
# Conservative approach: diff without context (--unified=0) so that code
# that was not changed does not create failures
git diff --unified=0 ${COMMIT_RANGE} -- ${files} | flake8 --diff --show-source ${options}
git diff --unified=0 ${COMMIT_RANGE} -- ${files} | flake8 --config ${FLAKE_CONFIG_FILE} --diff --show-source ${options}
fi
}

if [[ "$MODIFIED_PY_FILES" == "no_match" ]]; then
echo "No .py files has been modified"
else
check_files "$(echo "$MODIFIED_PY_FILES" )" "--ignore=E501,E731,E12,W503"
check_files "$(echo "$MODIFIED_PY_FILES" )"
fi
echo -e "No problem detected by flake8\n"

Expand All @@ -150,7 +151,7 @@ else
for fname in ${MODIFIED_IPYNB_FILES}
do
echo "File: $fname"
jupyter nbconvert --to script --stdout ${fname} | flake8 - --show-source --ignore=E501,E731,E12,W503,E402 --builtins=get_ipython || true
jupyter nbconvert --to script --stdout ${fname} | flake8 --config ${FLAKE_CONFIG_FILE} --show-source --builtins=get_ipython || true
done
fi

Expand Down
1 change: 0 additions & 1 deletion gensim/test/test_lsimodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def testTransformFloat32(self):
expected = np.array([-0.6594664, 0.142115444]) # scaled LSI version
self.assertTrue(np.allclose(abs(vec), abs(expected), atol=1.e-5)) # transformed entries must be equal up to sign


def testCorpusTransform(self):
"""Test lsi[corpus] transformation."""
model = self.model
Expand Down
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ artifact_indexes=
# https://github.com/MacPython/scikit-learn-wheels
http://wheels.scipy.org
# Windows wheels buit by:
# https://ci.appveyor.com/project/piskvorky/gensim
# https://ci.appveyor.com/project/piskvorky/gensim
http://17a25141cb7f75c18ee4-676a79255544e7711e0dd8bccdcdd1cb.r23.cf2.rackcdn.com

[flake8]
ignore = E501,E731,E12,W503,E402

0 comments on commit cb081db

Please sign in to comment.