From 2e56f2e56bc8b85abc3948f9516aa835f24f8e1d Mon Sep 17 00:00:00 2001 From: SnowGushiGit Date: Sun, 24 Sep 2017 13:59:59 +0900 Subject: [PATCH 1/9] Update for auto pep8 check --- .idea/vcs.xml | 6 ++++++ .travis.yml | 54 +++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..94a25f7f4 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 8b3e1cc83..b470bc927 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,48 @@ -language: php -php: - - 5.5 - - 5.4 - - hhvm -script: phpunit Test.php +language: python +python: + - 3.6 +notifications: + email: false + +before_install: + - sudo apt-get update + - sudo apt-get -y install python-pip + - sudo pip install --upgrade pip + - pip install --upgrade pip + - pip install pep8 + - pip install autopep8 + +script: + # Run pep8 on all .py files in all subfolders + # We must ignore E402 module level import not at top of file + # because of use case sys.path.append('..'); import + - num_errors_before=`find . -name \*.py -exec pep8 --ignore=E402 {} + | wc -l` + - echo $num_errors_before + + - cd "$TRAVIS_BUILD_DIR" + - git config --global user.email "mcurrie@bruceforceresearch.com" + # From https://help.github.com/articles/setting-your-username-in-git/: + # "Tip: You don't have to use your real name--any name works. Git + # actually associates commits by email address; the username is only + # used for identification. If you use your email address associated + # with a GitHub account, we'll use your GitHub username, instead of + # this name. + - git config --global user.name "Travis" + - git checkout $TRAVIS_BRANCH + + - find . -name \*.py -exec autopep8 --recursive --aggressive --aggressive --in-place {} + + - num_errors_after=`find . -name \*.py -exec pep8 --ignore=E402 {} + | wc -l` + - echo $num_errors_after + + - | + if (( $num_errors_after < $num_errors_before )); then + git commit -a -m "PEP-8 Fix" + git config --global push.default simple # Push only to the current branch. + # Make sure to make the output quiet, or else the API token will + # leak! This works because the API key can replace your password. + git push --quiet + fi + - cd "$TRAVIS_BUILD_DIR" + + # List the remaining errors - these will have to be fixed manually + - find . -name \*.py -exec pep8 --ignore=E402 {} + \ No newline at end of file From 39ef6ac53f4605729cf22dfbd519503ee5fcbc23 Mon Sep 17 00:00:00 2001 From: SnowGushiGit Date: Sun, 24 Sep 2017 14:03:12 +0900 Subject: [PATCH 2/9] Update for auto pep8 check --- Test.php | 10 ---------- Test.py | 4 ++++ 2 files changed, 4 insertions(+), 10 deletions(-) delete mode 100644 Test.php create mode 100644 Test.py diff --git a/Test.php b/Test.php deleted file mode 100644 index 4b44aa0f9..000000000 --- a/Test.php +++ /dev/null @@ -1,10 +0,0 @@ -assertEquals(1+1,1); - } -} - -?> diff --git a/Test.py b/Test.py new file mode 100644 index 000000000..be17c5c61 --- /dev/null +++ b/Test.py @@ -0,0 +1,4 @@ +import numpy as np + + +np.random.seed(42) \ No newline at end of file From 6bd91ec0f0ba8582462a42ca16fde28b140cc3b7 Mon Sep 17 00:00:00 2001 From: SnowGushiGit Date: Sun, 24 Sep 2017 14:04:52 +0900 Subject: [PATCH 3/9] Update for auto pep8 check --- Test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Test.py b/Test.py index be17c5c61..018a61ea3 100644 --- a/Test.py +++ b/Test.py @@ -1,4 +1,4 @@ import numpy as np - -np.random.seed(42) \ No newline at end of file +#hoge +np.random.seed(42) From d875f7c6c958955e7a2e8a567e5aa04b43120054 Mon Sep 17 00:00:00 2001 From: SnowGushiGit Date: Sun, 24 Sep 2017 14:15:24 +0900 Subject: [PATCH 4/9] Update for auto pep8 check --- Test.py => test.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Test.py => test.py (100%) diff --git a/Test.py b/test.py similarity index 100% rename from Test.py rename to test.py From 85458318c34208bee802949b3697dadab136f13f Mon Sep 17 00:00:00 2001 From: SnowGushiGit Date: Sun, 24 Sep 2017 14:20:46 +0900 Subject: [PATCH 5/9] Update for auto pep8 check by travis --- .travis.yml | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/.travis.yml b/.travis.yml index b470bc927..4a3febf84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,35 +14,6 @@ before_install: script: # Run pep8 on all .py files in all subfolders - # We must ignore E402 module level import not at top of file - # because of use case sys.path.append('..'); import - - num_errors_before=`find . -name \*.py -exec pep8 --ignore=E402 {} + | wc -l` - - echo $num_errors_before - - - cd "$TRAVIS_BUILD_DIR" - - git config --global user.email "mcurrie@bruceforceresearch.com" - # From https://help.github.com/articles/setting-your-username-in-git/: - # "Tip: You don't have to use your real name--any name works. Git - # actually associates commits by email address; the username is only - # used for identification. If you use your email address associated - # with a GitHub account, we'll use your GitHub username, instead of - # this name. - - git config --global user.name "Travis" - - git checkout $TRAVIS_BRANCH - - - find . -name \*.py -exec autopep8 --recursive --aggressive --aggressive --in-place {} + - - num_errors_after=`find . -name \*.py -exec pep8 --ignore=E402 {} + | wc -l` - - echo $num_errors_after - - - | - if (( $num_errors_after < $num_errors_before )); then - git commit -a -m "PEP-8 Fix" - git config --global push.default simple # Push only to the current branch. - # Make sure to make the output quiet, or else the API token will - # leak! This works because the API key can replace your password. - git push --quiet - fi - - cd "$TRAVIS_BUILD_DIR" - - # List the remaining errors - these will have to be fixed manually - - find . -name \*.py -exec pep8 --ignore=E402 {} + \ No newline at end of file + # (I ignore "E402: module level import not at top of file" + # because of use case sys.path.append('..'); import ) + - find . -name \*.py -exec pep8 --ignore=E402 {} + From ef6d609b43b9b5d6d02b26962a445b75644729b2 Mon Sep 17 00:00:00 2001 From: SnowGushiGit Date: Sun, 24 Sep 2017 14:22:54 +0900 Subject: [PATCH 6/9] Update for auto pep8 check --- test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.py b/test.py index 018a61ea3..6eb9d4d47 100644 --- a/test.py +++ b/test.py @@ -1,4 +1,4 @@ import numpy as np -#hoge +# hoge np.random.seed(42) From e1fab1e46cbe1d7ee4a82d03eb0902a884baa4a6 Mon Sep 17 00:00:00 2001 From: SnowGushiGit Date: Sun, 24 Sep 2017 14:29:36 +0900 Subject: [PATCH 7/9] Update pyflakes check --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4a3febf84..5fa0a6913 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ notifications: before_install: - sudo apt-get update - - sudo apt-get -y install python-pip + - sudo apt-get -y install python-pip pyflakes - sudo pip install --upgrade pip - pip install --upgrade pip - pip install pep8 @@ -17,3 +17,4 @@ script: # (I ignore "E402: module level import not at top of file" # because of use case sys.path.append('..'); import ) - find . -name \*.py -exec pep8 --ignore=E402 {} + + - find . -name \*.py -exec pyflakes {} + From 770b6b4491ccb7456cf624d36d479f0d7f41263d Mon Sep 17 00:00:00 2001 From: SnowGushiGit Date: Sun, 24 Sep 2017 14:30:21 +0900 Subject: [PATCH 8/9] Update pyflakes check miss --- test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test.py b/test.py index 6eb9d4d47..ec3935c6a 100644 --- a/test.py +++ b/test.py @@ -1,4 +1,5 @@ import numpy as np +import os # hoge np.random.seed(42) From 4de95c2edf21341153579da33b7fb4d0c1d39fab Mon Sep 17 00:00:00 2001 From: SnowGushiGit Date: Sun, 24 Sep 2017 14:33:05 +0900 Subject: [PATCH 9/9] Update pyflakes check --- test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test.py b/test.py index ec3935c6a..6eb9d4d47 100644 --- a/test.py +++ b/test.py @@ -1,5 +1,4 @@ import numpy as np -import os # hoge np.random.seed(42)