Skip to content
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

[py] Run type checks in CI and report typing coverage to codecov #9523

Merged
merged 9 commits into from Jul 16, 2021

Conversation

hoefling
Copy link
Contributor

@hoefling hoefling commented May 27, 2021

Description

This PR adds another Github action that runs type checks (using the mypy toxenv) and reports the current status to https://codecov.io. An example report, generated from this branch in my fork, can be viewed here: in the typing context, 100% coverage means all types could be successfully resolved and verified, while <100% indicates missing, incomplete or erroneous type hints. Navigating to a module unveils the spots in question.

Example: In the above example, the selenium.common package is fully typed (green color & 100% coverage), while selenium.webdriver.chrome.options module is not - more details can be found in tox_mypy job log, where mypy will report an error for the line. In this example:

selenium/webdriver/chrome/options.py:25: error: Implicit generic "Any". Use "typing.Dict" and specify generic parameters
selenium/webdriver/chrome/options.py:28: error: Function is missing a type annotation

(relevant spot in the job log for reference)

This way, one should be able to easily track the typing errors.

Motivation and Context

This is a proposal to address the discussion in #9482. It is added for @AutomatedTester for an evaluation!

Also, once merged into master, codecov should start tracking the changes in upcoming PRs, comparing typing coverage against the current master (an example on how it will look like, although this comment actually reports code coverage difference).

Once all typing errors are resolved (thus a 100% typing coverage achieved for the complete Python codebase), we can stop reporting the typing coverage and just run tox -c py/tox.ini in tox_mypy job. It will then simply fail on new typing errors.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
…tura reports

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
@hoefling
Copy link
Contributor Author

Here's the initial report for the upstream repo. Of course, there's nothing on master to compare against yet, so the codecov-bot will leave no comments as of now.

@sonarcloud
Copy link

sonarcloud bot commented May 27, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Member

@diemol diemol left a comment

Choose a reason for hiding this comment

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

Is there a way to this by using SonarQube? We already use it for the Java bindings and probably keeping an eye on different places is not ideal.

@hoefling
Copy link
Contributor Author

hoefling commented Jun 4, 2021

@diemol sure, but AFAIK SonarQube doesn't support mypy reports, only code coverage reports. Do you have plans to track test coverage with SonarQube?

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (trunk@e2866fc). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##             trunk    #9523   +/-   ##
========================================
  Coverage         ?   44.09%           
========================================
  Files            ?       82           
  Lines            ?     5445           
  Branches         ?      247           
========================================
  Hits             ?     2401           
  Misses           ?     2797           
  Partials         ?      247           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2866fc...c0d3414. Read the comment docs.

@AutomatedTester AutomatedTester merged commit 23eefa8 into SeleniumHQ:trunk Jul 16, 2021
@sonarcloud
Copy link

sonarcloud bot commented Jul 16, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants