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

Add mypy to CI #9430

Merged
merged 5 commits into from
Oct 7, 2022
Merged

Add mypy to CI #9430

merged 5 commits into from
Oct 7, 2022

Conversation

Mab879
Copy link
Member

@Mab879 Mab879 commented Aug 30, 2022

Description:

Add MyPy to the project's CI. MyPy is a static type checker for Python.

This will help enforce our type hits. Currently, this will be opt-in to avoid lots of errors in CI.

Rationale:

MyPy adds static type checking to help find errors sooner.

@Mab879 Mab879 added the Infrastructure Our content build system label Aug 30, 2022
@openshift-ci
Copy link

openshift-ci bot commented Aug 30, 2022

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Aug 30, 2022
@Mab879 Mab879 changed the title Add mypy ci Add mypy to CI Aug 30, 2022
@github-actions
Copy link

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@Mab879
Copy link
Member Author

Mab879 commented Sep 21, 2022

/packit build

@Mab879 Mab879 force-pushed the add_mypy_ci branch 2 times, most recently from aa9d5e1 to 1d906c4 Compare September 21, 2022 19:49
@Mab879
Copy link
Member Author

Mab879 commented Sep 23, 2022

/packit build

@Mab879 Mab879 marked this pull request as ready for review September 23, 2022 19:42
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Sep 23, 2022
@Mab879 Mab879 force-pushed the add_mypy_ci branch 2 times, most recently from 389997a to 0dfb9ab Compare September 26, 2022 18:22
@codeclimate
Copy link

codeclimate bot commented Sep 27, 2022

Code Climate has analyzed commit b96f3c0 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 40.7% (0.0% change).

View more on Code Climate.

@jan-cerny jan-cerny self-assigned this Oct 7, 2022
Copy link
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

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

It's super useful I like the idea.

When I break something in the tested sources then it works:

[jcerny@thinkpad build{pr/9430}]$ ctest --verbose -R test-mypy
UpdateCTestConfiguration  from :/home/jcerny/work/git/scap-security-guide/build/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/jcerny/work/git/scap-security-guide/build/DartConfiguration.tcl
Test project /home/jcerny/work/git/scap-security-guide/build
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 26
    Start 26: test-mypy

26: Test command: /usr/bin/env "/usr/bin/python3" "-m" "mypy" "/home/jcerny/work/git/scap-security-guide/utils/import_srg_spreadsheet.py"
26: Test timeout computed to be: 10000000
26: /home/jcerny/work/git/scap-security-guide/utils/import_srg_spreadsheet.py:45: error: Incompatible types in assignment (expression has type "str", variable has type "int")
26: /home/jcerny/work/git/scap-security-guide/utils/import_srg_spreadsheet.py:107: error: Argument 2 to "from_row" of "Row" has incompatible type "int"; expected "str"
26: Found 2 errors in 1 file (checked 1 source file)
1/1 Test #26: test-mypy ........................***Failed    3.73 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   3.73 sec

The following tests FAILED:
	 26 - test-mypy (Failed)
Errors while running CTest
Output from these tests are in: /home/jcerny/work/git/scap-security-guide/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.


```bash
# Fedora/RHEL
yum install python3-mypy
Copy link
Collaborator

Choose a reason for hiding this comment

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

dnf

@jan-cerny jan-cerny merged commit e2b14bf into ComplianceAsCode:master Oct 7, 2022
@jan-cerny jan-cerny added this to the 0.1.65 milestone Oct 7, 2022
@Mab879 Mab879 deleted the add_mypy_ci branch October 7, 2022 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Our content build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants