Skip to content

Skip file when no new lines added and lines-changed-only is asserted #21

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

Merged
merged 5 commits into from
Nov 14, 2022

Conversation

shenxianpeng
Copy link
Contributor

@shenxianpeng shenxianpeng commented Nov 12, 2022

I think the current change can stop adding --line-filter arg in clang-tidy when lines is empty.

But to skip adding annotation for such situation (only delete code), I guess need to change func range_of_changed_lines to get an empty list, but I am not sure how to change it. @2bndy5 could you help when you have time?

line_filter = range_of_changed_lines(file, lines_changed_only)

I used this test job to reproduce #18

@codecov-commenter
Copy link

codecov-commenter commented Nov 12, 2022

Codecov Report

Merging #21 (63d2211) into main (f53976a) will increase coverage by 0.82%.
The diff coverage is 90.47%.

@@            Coverage Diff             @@
##             main      #21      +/-   ##
==========================================
+ Coverage   80.68%   81.51%   +0.82%     
==========================================
  Files           6        6              
  Lines         647      649       +2     
==========================================
+ Hits          522      529       +7     
+ Misses        125      120       -5     
Impacted Files Coverage Δ
cpp_linter/run.py 79.15% <88.23%> (ø)
cpp_linter/__init__.py 92.06% <100.00%> (+0.26%) ⬆️
cpp_linter/thread_comments.py 66.66% <0.00%> (+4.62%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@2bndy5
Copy link
Contributor

2bndy5 commented Nov 12, 2022

The solution for this is going to need more than just a few lines changed. I'll start hacking it...

@2bndy5 2bndy5 changed the title Skip clang-tidy --line-filter when lines is empty Skip file when no new lines added and lines-changed-only is asserted Nov 12, 2022
@2bndy5
Copy link
Contributor

2bndy5 commented Nov 12, 2022

This branch is now overwritten by my changes to properly address #18.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    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
0.0% 0.0% Duplication

Copy link
Contributor Author

@shenxianpeng shenxianpeng left a comment

Choose a reason for hiding this comment

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

Your changes look good to me. 👏

@2bndy5
Copy link
Contributor

2bndy5 commented Nov 14, 2022

The unit tests agree with you. If released, this would be a patch version bump. I'm ready when you are.

@shenxianpeng shenxianpeng requested a review from 2bndy5 November 14, 2022 08:25
@shenxianpeng shenxianpeng added the bug Something isn't working label Nov 14, 2022
@shenxianpeng
Copy link
Contributor Author

I'm ready, let me test it in action after release.

@2bndy5
Copy link
Contributor

2bndy5 commented Nov 14, 2022

FYI, I added your p_enemy.c file to the unit test for precision.

@shenxianpeng
Copy link
Contributor Author

shenxianpeng commented Nov 14, 2022

So I need to keep p_enemy.c file always in the test-repo? at least I need to keep test-repo always existing, I think I will not delete it.

@shenxianpeng
Copy link
Contributor Author

I'm going to merge this pull request.

@shenxianpeng shenxianpeng merged commit 177be6b into main Nov 14, 2022
@shenxianpeng shenxianpeng deleted the fix-18 branch November 14, 2022 08:33
@2bndy5
Copy link
Contributor

2bndy5 commented Nov 14, 2022

So I need to keep p_enemy.c file always in the test-repo? at least I need to keep test-repo always existing, I think I will not delete it.

You shouldn't need to since the file's "added" state is specific to the commit that was pushed to the remote. I don't think GitHub deletes orphaned branches/commits.

@2bndy5
Copy link
Contributor

2bndy5 commented Nov 14, 2022

We could always change the file to a new file in this repo's demo src. Ironically, the name p_enemy.c is also used in chocolate-doom (which we also use in the unit test), but there's no conflict because chocolate-doom's file is located in src/hexen/p_enemy.c (your file is in the supposed repo-root).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants