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
Fix repetition in bear collection #2594
Conversation
I forgot to run the tests... |
hey you have some partial coverage thingies (the ones with yellow) because the else branches are not being tested. to fix this, you need to test the cases in which the if condition is not met :) |
I've been trying to sort that since yesterday D: The one thing I can't do is find a |
bears_by_section[section_name] = list(section.get("bears", "")) | ||
|
||
bears_to_collect = set(chain.from_iterable(bears_by_section.values())) | ||
bear_dirs_to_collect = set(chain(*bear_dirs_by_section.values())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first you use chain.from_iterable and then chain with *
, just use one of them consistenly shall we? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confess I did this for the sake of line length. Hobgoblin of Little Minds
and all that...
On 10 Aug 2016 08:35, "Lasse Schuirmann" notifications@github.com wrote:
In coalib/settings/SectionFilling.py
#2594 (comment):for section_name, section in sections.items():
bear_dirs = section.bear_dirs()
bears = list(section.get("bears", ""))
section_local_bears, section_global_bears = collect_bears(
bear_dirs,
bears,
[BEAR_KIND.LOCAL, BEAR_KIND.GLOBAL],
log_printer)
all_bears = copy.deepcopy(section_local_bears)
all_bears.extend(section_global_bears)
fill_section(section, acquire_settings, log_printer, all_bears)
bear_dirs_by_section[section_name] = section.bear_dirs()
bears_by_section[section_name] = list(section.get("bears", ""))
- bears_to_collect = set(chain.from_iterable(bears_by_section.values()))
- bear_dirs_to_collect = set(chain(*bear_dirs_by_section.values()))
first you use chain.from_iterable and then chain with *, just use one of
them consistenly shall we? ;)—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/coala-analyzer/coala/pull/2594/files/d33f368876807bf83487f02330eeb47dfae37c24#r74198024,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADrZ-M4IaROnb8BzfIoCAZZ673m32sPpks5qeX9YgaJpZM4JfA00
.
ping :) |
@AbdealiJK Apologies for leaving this half-finished for so long. Life got in the way. I have a few days free at least now. This is the only discussion I can find of it on Gitter with a quick search. In summary (and as far as I can remember), my change doesn't allow bears with the same class name but defined in different files (e.g. I hope that's helpful. |
I think you can ignore two bears with same name but different paths for now. The coala -b flag doesn't support that either to the best of my knowledge. It just chooses one of them (probably randomly) So make an issue for bears with same name not working correctly in many places, as it would have to be fixed in many places not just this one. (show bears, mentioning bears in cli, mentioning bear as a dependency, etc) |
@AbdealiJK Will do. I just updated my branch by pulling from upstream, but I just realised that the commit title is overlong. D'oh, not sure what to do about that. Sorry. I'll fix any CI issues now if I can. |
Hey, so we don't allow Merge commits like the one you pushed here into master normally. WHat you need to do is rebase on the current master - http://docs.coala.io/en/latest/Developers/Git_Basics.html?highlight=rebase#rebasing |
OK cool. I did that before, don't know why I forgot. Do I need to do anything before rebasing? Also, I'm not entirely sure how to fix that failing test. |
bears_to_collect, | ||
[BEAR_KIND.LOCAL, BEAR_KIND.GLOBAL], | ||
log_printer) | ||
all_bears = copy.deepcopy(all_local_bears) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a deepcopy ? Can't we just chain
these ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I can't remember, chain
should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't work properly with just chain
, I have to call list
on it which makes me think it's something to do with depleting the chain
generator. That confuses me though, because I only refer to all_bears
once.
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
I would like to pick this up again if that's OK. If you'd rather I pick up a newcomer or difficulty low issue that's fine. I can only apologise again for inactivity, February was mad. If you're OK with me picking this up, I should be able to start tomorrow. |
@whonut everything alright, no need for apologies :) And sure you can continue to work, "my next project" means I'm gonna start it... somewhen, so, in ~10 years :P |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
22 similar comments
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Closing due to inactivity. |
Addresses #2075.
I'm not sure if this is what @sils1297 has in-mind, but it does fix the issue of bears being collected multiple times.