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

Pylint integration and more tests #17

Merged
merged 2 commits into from
Jan 31, 2022
Merged

Pylint integration and more tests #17

merged 2 commits into from
Jan 31, 2022

Conversation

yugr
Copy link
Collaborator

@yugr yugr commented Jan 29, 2022

No description provided.

@codecov
Copy link

codecov bot commented Jan 29, 2022

Codecov Report

Merging #17 (17d3847) into main (37c5d76) will increase coverage by 2.80%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #17      +/-   ##
==========================================
+ Coverage   49.53%   52.33%   +2.80%     
==========================================
  Files           4        4              
  Lines         214      214              
==========================================
+ Hits          106      112       +6     
+ Misses        108      102       -6     
Impacted Files Coverage Δ
src/asm2cfg/asm2cfg.py 69.56% <0.00%> (+3.72%) ⬆️

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 37c5d76...17d3847. Read the comment docs.

Copy link
Owner

@Kazhuu Kazhuu left a comment

Choose a reason for hiding this comment

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

Thank you contributing again and great progress! I tested this PR locally and left some comments I noticed.

.pylintrc Outdated Show resolved Hide resolved
run: pipenv run pylint src
run: |
pipenv run pylint src test
pipenv run pylint -d duplicate-code,invalid-name test/templates/*.py
Copy link
Owner

Choose a reason for hiding this comment

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

Does disabling these do anything? I tested this locally with .pylintrc file deleted. I only get following warnings:

Quote delimiter " is inconsistent with the rest of the file

And does above pylint run file already cover template code right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I still needed to disable these warnings for scripts in test/templates because otherwise my version of pylint (Ubuntu 20.04) was complaining about invalid case of variables (he wants them all uppercase) and some code duplication.

Copy link
Owner

@Kazhuu Kazhuu Jan 30, 2022

Choose a reason for hiding this comment

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

Which version of pylint you are using? Maybe we should force it to specific version in Pipfile instead because of this. I mean if you get different warnings than me.

When I run pytest -v, the first line prints following. I'm running Manjaro with i3.

platform linux -- Python 3.10.1, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /home/kazhuu/.local/share/virtualenvs/asm2cfg-954QkiKO/bin/python

Copy link
Owner

Choose a reason for hiding this comment

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

And also are these errors coming up in CI pipeline?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have

yugr@yugr-VirtualBox:~/src/my/asm2cfg$ pipenv run pylint --version
pylint 2.12.2
astroid 2.9.3
Python 3.8.10 (default, Nov 26 2021, 20:14:08) 
[GCC 9.3.0]

I'm not sure how to go about these differences, maybe require a minimum Pylint version if pipenv supports this.

Copy link
Owner

Choose a reason for hiding this comment

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

Ah sorry the previous output doesn't even contain the version output. Here is mine:

~/programming/asm2cfg (tests/5*) » pylint --version                                                                                                                                                                                                                                                                                                      127 ↵ kazhuu@kazhuu
pylint 2.12.2
astroid 2.9.3
Python 3.10.1 (main, Dec 18 2021, 23:53:45) [GCC 11.1.0]

It seems we are using the same version. Wonder where you get the errors. What is the specific line you use to run pylint?

test/test_parser.py Outdated Show resolved Hide resolved
_, blocks = asm2cfg.parse_lines(lines, False)

# TODO: special block for indirect jumps
self.assertEqual(len(blocks), 2)
Copy link
Owner

Choose a reason for hiding this comment

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

I tried to see why this test fails. I think you forgot to add split('\n') call at the end. Then you get three blocks which seems correct to me. Could you please refactor this to be a working test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, fixed. I would still expect 4 blocks here (mind the notrack jmp instruction).

test/test_regex.py Outdated Show resolved Hide resolved
Copy link
Owner

@Kazhuu Kazhuu left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! Now the PR looks better.

@Kazhuu Kazhuu merged commit 5c726e1 into Kazhuu:main Jan 31, 2022
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.

2 participants