-
Notifications
You must be signed in to change notification settings - Fork 76
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
coala-quickstart.py: Change the printing of bears #227
base: master
Are you sure you want to change the base?
Conversation
@gitmate-bot rebase |
Hey! I'm GitMate.io! This pull request is being rebased automatically. Please DO NOT push while rebase is in progress or your changes would be lost permanently |
Automated rebase with GitMate.io was successful! 🎉 |
Travis tests have failedHey @tallicamike, 3rd Buildpytest
|
coala_quickstart/generation/Bears.py
Outdated
@@ -6,7 +6,7 @@ | |||
|
|||
from coala_quickstart.Constants import ( | |||
IMPORTANT_BEAR_LIST, ALL_CAPABILITIES, DEFAULT_CAPABILTIES) | |||
from coala_quickstart.Strings import BEAR_HELP | |||
from coala_quickstart.Strings import (PRINT_BEARS, BEAR_HELP) |
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.
no need of paranthesis here
coala_quickstart/generation/Bears.py
Outdated
""" | ||
Prints the relevant bears in sections separated by language. | ||
Prints both the usable and unusable, relevant bears | ||
in sections separated by language. |
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.
"seperated by language?"
needs a language change over here 😉
coala_quickstart/Strings.py
Outdated
PRINT_BEARS = {'unusable': | ||
{'msg': """ | ||
\nBased on the configuration options the following | ||
bears have been identified to be unusable: |
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.
an extra message on how to make these bears usable too would be good over here
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.
indicating that these bears can be made usable if coala-quickstart
is not run in non-interactive mode (not exactly this language)
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.
Ok, I have to change this, it sound better with the indications. Also, do you feel that using PRINT_BEARS
as in the PR is an ok option? I feel that it somehow looks ugly (hacky), but on the other hand I feel that the other options either add duplicate code, or are less flexible?
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 don't think it looks ugly or hacky, for the same reason
on the other hand I feel that the other options either add duplicate code
coala_quickstart/Strings.py
Outdated
|
||
PRINT_BEARS = {'unusable': | ||
{'msg': """ | ||
\nBased on the configuration options the following |
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.
remove the \n
in the front of the messages as it is creating additional blank lines
@tallicamike this is a good patch although can't make out why you need an |
@@ -2,6 +2,7 @@ | |||
import logging | |||
import os | |||
import sys | |||
from collections import OrderedDict |
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 don't see the use of ordered dict over here
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 used a OrderedDict there because I wanted to make sure that each time coala-quickstart
is run, fristly the unused
bears are printed and then the used
bears. (I wanted a deterministic execution, and, for the user, if he doesn't want to check the full log he'll only get a glimpse at the ones that were chosen - I feel this is the most common case). Sounds ok? Or should I change it?
manual rebase is needed |
coala_quickstart/generation/Bears.py
Outdated
for label_bears in nonempty_label_bears: | ||
printer.print(PRINT_BEARS[label_bears]['msg']) | ||
for language in relevant_bears[label_bears]: | ||
printer.print(" [" + language + "]", |
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.
You do not use the preferred quotation marks.
Origin: QuotesBear, Section: all.quotes
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpswjp7wec/coala_quickstart/generation/Bears.py
+++ b/tmp/tmpswjp7wec/coala_quickstart/generation/Bears.py
@@ -236,7 +236,7 @@
for label_bears in nonempty_label_bears:
printer.print(PRINT_BEARS[label_bears]['msg'])
for language in relevant_bears[label_bears]:
- printer.print(" [" + language + "]",
+ printer.print(' [' + language + "]",
color=PRINT_BEARS[label_bears]["colors"][0])
for bear in relevant_bears[label_bears][language]:
printer.print(" " + bear.name,
coala_quickstart/generation/Bears.py
Outdated
for label_bears in nonempty_label_bears: | ||
printer.print(PRINT_BEARS[label_bears]['msg']) | ||
for language in relevant_bears[label_bears]: | ||
printer.print(" [" + language + "]", |
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.
You do not use the preferred quotation marks.
Origin: QuotesBear, Section: all.quotes
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpswjp7wec/coala_quickstart/generation/Bears.py
+++ b/tmp/tmpswjp7wec/coala_quickstart/generation/Bears.py
@@ -236,7 +236,7 @@
for label_bears in nonempty_label_bears:
printer.print(PRINT_BEARS[label_bears]['msg'])
for language in relevant_bears[label_bears]:
- printer.print(" [" + language + "]",
+ printer.print(" [" + language + ']',
color=PRINT_BEARS[label_bears]["colors"][0])
for bear in relevant_bears[label_bears][language]:
printer.print(" " + bear.name,
coala_quickstart/generation/Bears.py
Outdated
printer.print(PRINT_BEARS[label_bears]['msg']) | ||
for language in relevant_bears[label_bears]: | ||
printer.print(" [" + language + "]", | ||
color=PRINT_BEARS[label_bears]["colors"][0]) |
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.
You do not use the preferred quotation marks.
Origin: QuotesBear, Section: all.quotes
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpswjp7wec/coala_quickstart/generation/Bears.py
+++ b/tmp/tmpswjp7wec/coala_quickstart/generation/Bears.py
@@ -237,7 +237,7 @@
printer.print(PRINT_BEARS[label_bears]['msg'])
for language in relevant_bears[label_bears]:
printer.print(" [" + language + "]",
- color=PRINT_BEARS[label_bears]["colors"][0])
+ color=PRINT_BEARS[label_bears]['colors'][0])
for bear in relevant_bears[label_bears][language]:
printer.print(" " + bear.name,
color=PRINT_BEARS[label_bears]["colors"][1])
coala_quickstart/generation/Bears.py
Outdated
printer.print(" [" + language + "]", | ||
color=PRINT_BEARS[label_bears]["colors"][0]) | ||
for bear in relevant_bears[label_bears][language]: | ||
printer.print(" " + bear.name, |
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.
You do not use the preferred quotation marks.
Origin: QuotesBear, Section: all.quotes
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpswjp7wec/coala_quickstart/generation/Bears.py
+++ b/tmp/tmpswjp7wec/coala_quickstart/generation/Bears.py
@@ -239,7 +239,7 @@
printer.print(" [" + language + "]",
color=PRINT_BEARS[label_bears]["colors"][0])
for bear in relevant_bears[label_bears][language]:
- printer.print(" " + bear.name,
+ printer.print(' ' + bear.name,
color=PRINT_BEARS[label_bears]["colors"][1])
printer.print("")
coala_quickstart/generation/Bears.py
Outdated
color=PRINT_BEARS[label_bears]["colors"][0]) | ||
for bear in relevant_bears[label_bears][language]: | ||
printer.print(" " + bear.name, | ||
color=PRINT_BEARS[label_bears]["colors"][1]) |
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.
You do not use the preferred quotation marks.
Origin: QuotesBear, Section: all.quotes
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpswjp7wec/coala_quickstart/generation/Bears.py
+++ b/tmp/tmpswjp7wec/coala_quickstart/generation/Bears.py
@@ -240,7 +240,7 @@
color=PRINT_BEARS[label_bears]["colors"][0])
for bear in relevant_bears[label_bears][language]:
printer.print(" " + bear.name,
- color=PRINT_BEARS[label_bears]["colors"][1])
+ color=PRINT_BEARS[label_bears]['colors'][1])
printer.print("")
coala_quickstart/generation/Bears.py
Outdated
for bear in relevant_bears[label_bears][language]: | ||
printer.print(" " + bear.name, | ||
color=PRINT_BEARS[label_bears]["colors"][1]) | ||
printer.print("") |
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.
You do not use the preferred quotation marks.
Origin: QuotesBear, Section: all.quotes
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpswjp7wec/coala_quickstart/generation/Bears.py
+++ b/tmp/tmpswjp7wec/coala_quickstart/generation/Bears.py
@@ -241,7 +241,7 @@
for bear in relevant_bears[label_bears][language]:
printer.print(" " + bear.name,
color=PRINT_BEARS[label_bears]["colors"][1])
- printer.print("")
+ printer.print('')
def generate_requirements_map(bears):
tests/generation/Bears.py
Outdated
[('Python', 70), ('Unknown', 30)], self.printer, | ||
self.arg_parser, {})) | ||
print_relevant_bears(self.printer, OrderedDict([('unusable', {}), | ||
('usable', filter_relevant_bears([('Python', 70), ('Unknown', 30)], |
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.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: all.autopep8
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpswjp7wec/tests/generation/Bears.py
+++ b/tmp/tmpswjp7wec/tests/generation/Bears.py
@@ -288,8 +288,8 @@
def test_print_relevant_bears(self):
with retrieve_stdout() as custom_stdout:
print_relevant_bears(self.printer, OrderedDict([('unusable', {}),
- ('usable', filter_relevant_bears([('Python', 70), ('Unknown', 30)],
- self.printer, self.arg_parser, {}))]))
+ ('usable', filter_relevant_bears([('Python', 70), ('Unknown', 30)],
+ self.printer, self.arg_parser, {}))]))
self.assertIn("PycodestyleBear", custom_stdout.getvalue())
# Should print only the usable bears
self.assertNotIn("unusable",
tests/generation/Bears.py
Outdated
self.arg_parser, {})) | ||
print_relevant_bears(self.printer, OrderedDict([('unusable', {}), | ||
('usable', filter_relevant_bears([('Python', 70), ('Unknown', 30)], | ||
self.printer, self.arg_parser, {}))])) |
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.
E128 continuation line under-indented for visual indent
Origin: PycodestyleBear (E128), Section: all.autopep8
.
tests/generation/Bears.py
Outdated
def test_print_relevant_bears_no_bears(self): | ||
with retrieve_stdout() as custom_stdout: | ||
print_relevant_bears(self.printer, OrderedDict([('unusable', {}), | ||
('usable', {})])) |
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.
E128 continuation line under-indented for visual indent
Origin: PycodestyleBear (E128), Section: all.autopep8
.
tests/generation/Bears.py
Outdated
self.assertNotIn("usable", | ||
# Should print only the usable bears | ||
self.assertIn("usable", | ||
custom_stdout.getvalue()) |
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.
E127 continuation line over-indented for visual indent
Origin: PycodestyleBear (E127), Section: all.autopep8
.
tests/generation/Bears.py
Outdated
[('Python', 70), ('Unknown', 30)], self.printer, | ||
self.arg_parser, {})) | ||
print_relevant_bears(self.printer, OrderedDict([('unusable', {}), | ||
('usable', filter_relevant_bears([('Python', 70), ('Unknown', 30)], |
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.
Line is longer than allowed. (83 > 80)
Origin: LineLengthBear, Section: all.linelength
.
Travis tests have failedHey @tallicamike, 3rd Buildcoala --non-interactive
|
coala_quickstart/generation/Bears.py
Outdated
printer.print(BEAR_HELP) | ||
|
||
# Don't print anything for empty bear sets | ||
nonempty_label_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.
Should we print something if there are no relevant 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.
i am sure that would never be the case 😉
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.
yeah, imo a simple print statement saying no relevant bears found should suffice (just in case there's a change of design in future which actually allows no relevant bears, we don't want user to be confused when he sees an empy screen with no message printed)
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.
ok
coala_quickstart/Strings.py
Outdated
|
||
PRINT_BEARS = {'unusable': | ||
{'msg': """ | ||
Based on the configuration options the following bears have been identified |
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.
2 spaces after options
coala_quickstart/Strings.py
Outdated
PRINT_BEARS = {'unusable': | ||
{'msg': """ | ||
Based on the configuration options the following bears have been identified | ||
as unusable ('-C' or '--ci' set non-interactive mode, making the bears that |
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.
set ?? misplaced word?
coala_quickstart/Strings.py
Outdated
Based on the configuration options the following bears have been identified | ||
as unusable ('-C' or '--ci' set non-interactive mode, making the bears that | ||
need to be configured by the user unusable: check '--allow-incomplete-sections' | ||
for more information): |
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.
or don't run in non interactive mode
tests/generation/Bears.py
Outdated
print_relevant_bears(self.printer, OrderedDict([('unusable', {}), | ||
('usable', {})])) | ||
self.assertNotIn("usable", custom_stdout.getvalue()) | ||
# Should print only the usable 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.
no output is being printed in this case right?
this comment seems misleading because of that.
coala_quickstart/Strings.py
Outdated
PRINT_BEARS = {'unusable': | ||
{'msg': """ | ||
Based on the configuration options the following bears have been identified | ||
as unusable (options '-C' or '--ci' (non interactive mode) make the bears that |
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.
language trouble, parenthesis shouldn't be here starting before the options
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.
imo, the sentence is too long too, needs to split.
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.
currently, there's nesting of braces, and the sentence inside the braces is long too.
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.
How about this: "The following bears have been dropped because '-C'/'--ci' (non interactive mode) option has ben selected. Remove the option or check '--allow-incomplete-sections' option for more information on how to include them:" ?
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.
sounds good.
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.
LGTM ping @satwikkansal
coala_quickstart/Strings.py
Outdated
@@ -50,3 +50,18 @@ | |||
|
|||
You can see all of them here: {} | |||
""".format(BEAR_DOCS_URL) | |||
|
|||
PRINT_BEARS = {'unusable': | |||
{'msg': """ |
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.
A slight indentation issue, can you move the opening brace to previous line
PRINT_BEARS = {'unusable': {
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.
will do
coala_quickstart/Strings.py
Outdated
PRINT_BEARS = {'unusable': | ||
{'msg': """ | ||
Based on the configuration options the following bears have been identified | ||
as unusable (options '-C' or '--ci' (non interactive mode) make the bears that |
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.
imo, the sentence is too long too, needs to split.
coala_quickstart/Strings.py
Outdated
PRINT_BEARS = {'unusable': | ||
{'msg': """ | ||
Based on the configuration options the following bears have been identified | ||
as unusable (options '-C' or '--ci' (non interactive mode) make the bears that |
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.
currently, there's nesting of braces, and the sentence inside the braces is long too.
coala_quickstart/Strings.py
Outdated
Based on the configuration options the following bears have been identified | ||
as unusable (options '-C' or '--ci' (non interactive mode) make the bears that | ||
need to be configured by the user unusable: don't run in non interactive mode | ||
or check '--allow-incomplete-sections' for more information on how to include |
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.
"or check '--allow-incomplete-sections' option for more information...
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.
add "option" to it, that is?
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.
yep
coala_quickstart/Strings.py
Outdated
or check '--allow-incomplete-sections' for more information on how to include | ||
the unusable bears): | ||
""", | ||
'colors': ('green', 'red')}, |
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.
There seems like an indentation issue in the entire dict, can you please check that?
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.
The linter isn't complaining, but indeed it is hard to read. Re-writing it nicely kind of beats me, what I would suggest would be to add variables for each 'msg' value of the dictionary so it should be more "readable". (or another option would be to create variables for the inner dictionaries - 'unusable' and 'usable')
I'm thinking of something like this:
PRINT_BEARS = {
'unusable': {
'msg': PRINT_UNUSABLE,
'colors': ('green', 'red')
},
What are your thoughts on this?
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.
Yeah, that's a nice idea.
print_relevant_bears(printer, relevant_bears) | ||
|
||
# Drop unusable bears | ||
relevant_bears = relevant_bears['usable'] |
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.
Isn't the remove_unusable_bears
method doing this?
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.
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 changed remove_unusable_bears
to also add the unusable
bears to the OrderdDict, but I'm using that only for printing purposes. Here the printing has ended, so I drop unusable
bears from the dict.
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 changed remove_unusable_bears to also add the unusable bears to the OrderdDict
doesn't that contradict with the function name? remove_unusable_bears
is adding unusable bears to OrdereDict
coala_quickstart/coala_quickstart.py
Outdated
print_relevant_bears(printer, relevant_bears) | ||
# OrderedDict used for print_relevant_bears to first print unusable bears | ||
relevant_bears = OrderedDict( | ||
[('unusable', {}), |
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.
Not sure if I full understand this, where are we populating the dictionary with key unusable
😅
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.
see remove_unusable_bears
in this PR
coala_quickstart/generation/Bears.py
Outdated
printer.print(BEAR_HELP) | ||
|
||
# Don't print anything for empty bear sets | ||
nonempty_label_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.
yeah, imo a simple print statement saying no relevant bears found should suffice (just in case there's a change of design in future which actually allows no relevant bears, we don't want user to be confused when he sees an empy screen with no message printed)
coala_quickstart/generation/Bears.py
Outdated
@@ -200,38 +200,48 @@ def get_non_optional_settings_bears(bears): | |||
|
|||
def remove_unusable_bears(bears, unusable_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.
I think based on the new changes, a better name could be filter_unsuable_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.
Oh, you are right! I didn't thought about that! Makes more sense now! Thank you!
Remove duplicate printing of `relevant_bears` and instead change `print_relevant_bears` to inform the user both of the usable and unusable bears. Closes coala#220
printer.print('') | ||
printer.print(BEAR_HELP) | ||
|
||
nonempty_label_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.
nonempty -> non_empty
|
||
if not nonempty_label_bears: | ||
printer.print('No relevant bears were found.') | ||
else: |
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.
you can use return
here if there are no bears to print
then the following can be dedented
PRINT_BEARS = { | ||
'unusable': { | ||
'msg': PRINT_UNUSABLE, | ||
'colors': ('green', 'red') |
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.
add trailing comma
|
||
print_relevant_bears(printer, relevant_bears) | ||
# OrderedDict used for print_relevant_bears to first print unusable bears | ||
relevant_bears = OrderedDict( |
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.
labelled_bears = {'usable': selected_bears}
print_labels = ['usable']
@@ -103,18 +104,27 @@ def main(): | |||
|
|||
extracted_information = collect_info(project_dir) | |||
|
|||
relevant_bears = filter_relevant_bears( | |||
selected_bears = filter_relevant_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.
unnecessary .. see elsewhere
@@ -201,40 +201,52 @@ def get_non_optional_settings_bears(bears): | |||
return non_optional_settings | |||
|
|||
|
|||
def remove_unusable_bears(bears, unusable_bears): | |||
def filter_unusable_bears(bears, unusable_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.
This can stay as remove_unusable_bears
, and return the removed bears grouped by language.
for bear in tuple(language_bears): | ||
if bear in unusable_bears: | ||
bears[language].remove(bear) | ||
bears['usable'][language].remove(bear) | ||
bears['unusable'][language] = bears['unusable'].get( |
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.
return a new dict with the unusable bears grouped by language.
|
||
|
||
def print_relevant_bears(printer, relevant_bears, label='relevant'): | ||
def print_relevant_bears(printer, relevant_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.
change this to:
def print_bears(printer, labelled_bears, labels=['usable']):
The order of the labels is then used to determine which groups to show.
print_relevant_bears(printer, relevant_bears, 'usable') | ||
unusable_bears = get_non_optional_settings_bears( | ||
relevant_bears['usable']) | ||
filter_unusable_bears(relevant_bears, unusable_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.
labelled_bears['unusable'] = remove_unusable_bears(relevant_bears, unusable_bears)
print_labels = ['unusable', 'usable']
relevant_bears['usable']) | ||
filter_unusable_bears(relevant_bears, unusable_bears) | ||
|
||
print_relevant_bears(printer, relevant_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.
print_labelled_bears(print, labelled_bears, print_labels)
Remove duplicate printing of
relevant_bears`` and instead change
print_relevant_bears` to inform the user both of the usable andunusable bears.
Closes #220