-
-
Notifications
You must be signed in to change notification settings - Fork 393
Enhance mypy support. #126
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
Conversation
tools/lister.py
Outdated
if os.path.isdir(normed_path): | ||
exclude_abspaths += [os.path.normpath(os.path.join(repository_root, fpath)) for fpath in list_files(targets=[normed_path])] | ||
else: | ||
exclude_abspaths.append(normed_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this didn't already work? This should work:
if any(absfpath == expath or absfpath.startswith(expath + '/')
for expath in exclude_abspaths):
continue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my tests and the comment in the code, excludes_paths
didn't exclude directories - we might want to make the same change to zulip
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the comments are inaccurate. Looking at the history, we used to have contrib_bots/bots
in the exclude paths in the server repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right - I see the issue then, it's Windows paths:
if any(absfpath == expath or absfpath.startswith(expath + '/')
for expath in exclude_abspaths):
continue
hardcodes the delimiter, so it didn't work for the Windows files. Will update that snippet instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, yeah, and that fix we should contribute to the main repo too.
.travis.yml
Outdated
env: TEST_SUITE=lint | ||
- python: "3.6" | ||
env: TEST_SUITE=run-mypy | ||
env: TEST_SUITE=test-static |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe TEST_SUITE=static-analysis
? I feel like we probably want this to be clearer than "test-static" as to what it is.
tools/run-mypy
Outdated
if rc: | ||
sys.exit(rc) | ||
else: | ||
print("There are no files to run mypy on.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want it to check all 3 packages even if there are errors in the first one; so we should stored a failed
variable instead of existing immediately on the first error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I was not sure about that bit.
I posted a few comments; thanks for working on this @derAnfaenger! |
Updated. Includes a new commit to remove the duplicate lister.py |
This is good enough; I made one change to the last commit to remove the I'm not totally convinced by the use of |
I used |
OK, I guess that's fine. |
|
The |
This
runs mypy and lint in a single travis job (so we have five jobs again, the maximum that can be parallely executed)
adds support for adding directories to the
lister
exclude list (needed for excluding zulip_bots/zulip_bots/botsruns mypy for each package fully and separately
excludes all files that need to be fixed.
Btw I noticed that we have a
lister
duplicate; one in tools and one intools/server_lib
. Which one should we keep? I vote for theserver_lib
one and movepep8
andcustom_check.py
there.