]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
script/run_mypy: Support mypy 0.740 31192/head
authorSebastian Wagner <sebastian.wagner@suse.com>
Mon, 28 Oct 2019 12:13:33 +0000 (13:13 +0100)
committerSebastian Wagner <sebastian.wagner@suse.com>
Mon, 4 Nov 2019 09:36:07 +0000 (10:36 +0100)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Co-Authored-By: Ernesto Puerta <37327689+epuertat@users.noreply.github.com>
src/script/run_mypy.sh

index ee2e97911457c9254823c93c2b136b0c1bc8e017..318a2c622e622ee3537c990289c6b6cab366fc06 100755 (executable)
@@ -3,11 +3,13 @@
 # needs to be executed from the src directory.
 # generates a report at src/mypy_report.txt
 
+set -e
+
 python3 -m venv .mypy_venv
 
 . .mypy_venv/bin/activate
 
-pip install $(find * -name requirements.txt | grep -v node_modules | awk '{print "-r  " $0}')
+! pip install $(find -name requirements.txt -not -path './frontend/*' -printf '-r%p ')
 pip install mypy
 
 MYPY_INI="$PWD"/mypy.ini
@@ -29,6 +31,7 @@ popd
 
 SORT_MYPY=$(cat <<-EOF
 #!/bin/python3
+import re
 from collections import namedtuple
 
 class Line(namedtuple('Line', 'prefix no rest')):
@@ -36,6 +39,8 @@ class Line(namedtuple('Line', 'prefix no rest')):
     def parse(cls, l):
         if not l:
             return cls('', 0, '')
+        if re.search('Found [0-9]+ errors in [0-9]+ files', l):
+            return cls('', 0, '')     
         p, *rest = l.split(':', 2)
         if len(rest) == 1:
             return cls(p, 0, rest[0])
@@ -100,4 +105,4 @@ with open('mypy_report.txt', 'w') as f:
 EOF
 )
 
-python <(echo "$SORT_MYPY")
\ No newline at end of file
+python <(echo "$SORT_MYPY")