Comments (7)
Ill see if I can reproduce this. What you have there looks right to me. PyLint seems to be somewhat flawed in diff-quality. Hopefully I can figure this out sometime this week
from diff_cover.
Howdy.
I reproduced this issue. It seems passing in the report is breaking fail under which make me sad :-(
I verified that not passing in the report works as expected
(venv) ~/code/testproject issue31 diff-quality --compare-branch=master --violations=pylint --fail-under=100
-------------
Diff Quality
Quality Report: pylint
Diff: master...HEAD, staged, and unstaged changes
-------------
woah.py (87.5%):
4: C0103: (invalid-name), badlyNamedFunction: Invalid function name "badlyNamedFunction"
-------------
Total: 8 lines
Violations: 1 line
% Quality: 87%
-------------
Failure. Quality is below 100.0%.
(venv) ✘ ~/code/testproject issue31 echo $?
1
I will will try to get a fix out to this quickly.
from diff_cover.
@butla hey, I realized that the problem could be how the pylint report was generated. Diff-quality depends on a very specific way of running the report to have a chance of working correctly. (honestly I probably should not allow people to pass in reports at all because of this.... sorry.)
So when you dont pass in the report diff-quality will run on individual files with this command
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}"
You can try generating your report with that template. Is your project private? Or can you share the pylint report and the diff that diff-quality is working with?
from diff_cover.
Hey, thanks for the answer. It works! :)
I only have two issues with this:
- I'd also want to be able to see the old (not the newly introduced ones) pylint issues.
- Is there some way to exclude a folder from being checked? In my current setup I don't run Pylint on my tests.
Also, I've made a very crude "pylint-diff-quality.sh" for my use:
CURRENT_ISSUES=$(pylint $MODULE_NAME | wc -l)
git stash
NEW_ISSUES=$(pylint $MODULE_NAME | wc -l)
ISSUE_DIFF=$(($CURRENT_ISSUES - $NEW_ISSUES))
git stash pop
echo $ISSUE_DIFF
exit $ISSUE_DIFF
I know I should checkout origin/master and then the branch I was on originally instead of stashing. Does diff-cover also work like that?
from diff_cover.
By default diff-cover should reach out to origin and I dont think you need to pull it down. I inherited the codebase so I am still leaning things.
Diff-cover/diff-quality are designed to only work on changes so for the full report I think you just need to run pylint directly.
Finally for excluding a folder see if there is something that can go into your pylintrc file. I believe diff-quality respects that
from diff_cover.
Pylint needs to be used on a Python package or module. "ignore" in .pylintrc can be used to skip something in that selected context. If diff-quality runs on every file by itself then cutting out a module is unfeasible. But I'm no expert, I'm just telling you what I've worked out :)
I've also tried running diff-quality only in the folder that I want checked... It doesn't seem to detect any problems then.
Anyway, I guess I'll be using my custom script to do the checking, so you can close the issue if you want. Or you can leave this as some feature request :)
And good luck with the project, I really think that something like this can be useful to safeguard a project against sloppy code (and everyone makes that, sometimes).
from diff_cover.
@butla @Bachmann1234: diff-quality supports since version 5.1.0 an include option as well since 1.0.0 an exclude option. With this there is no need to use the pylint configuration to exclude stuff.
The other issues seem to be resolved. So, I guess this issue can be closed
from diff_cover.
Related Issues (20)
- Feature request — Invert output to find flaky tests and help determine test failures HOT 1
- does this tool support C++ opencppcoverage? cppcoverage has html, cobertura reports. HOT 1
- urgent!! work environment!!No lines with coverage information in this diff. HOT 2
- new Github action for diff-cover HOT 1
- There is a folder code that cannot be counted. It has been analyzed for a long time, please help HOT 1
- 5 tests fail HOT 2
- Package has classifier "License :: Other/Proprietary License" - raising licensing flags for Sonatype HOT 3
- Enhancing Report Visualization in 'diff-cover' Project for Improved Code Analysis HOT 2
- 7.7.0: pytest is failing in `tests/test_violations_reporter.py::TestFlake8QualityReporterTest::test_file_does_not_exist` unit HOT 33
- Support ruff for quality checking HOT 1
- diff everything on removal HOT 11
- Diff between two coverage files instead of coverage file from branch HOT 2
- Running diff-quality with a tool which is not installed gives FIleNotFoundError rather than helpful "<tool> is not installed" error message HOT 2
- Add support for Pyright as a quality-checking tool HOT 2
- A little suggest about supporting Windows system commands
- How to show the covered line in the diff coverage html report? HOT 1
- 2 tests fail HOT 1
- No lines with coverage information in this diff. HOT 1
- Customise reporting
- UnicodeDecodeError when an untracked binary file is present in the repository HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diff_cover.