-
Notifications
You must be signed in to change notification settings - Fork 69
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
Improve project health #147
Conversation
I believe that @cuducos may help us with it.
Yeah we are trying to have a at least a minor bump version for any change in this project. :) |
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.
Once more, many thanks for the contribution @giovanisleite!
IMHO some changes you made are inconsistent in terms of style. I commented on them inline.
Regarding some comments you posted:
1 invalid-name "fh" - I couldn't understand what it means, so I couldn't think a valid name for it.
fh
is usually adopted in the Python community as an abbreviation for file handler. IMHO you can replace it by handler
for example — if you want. Anyway personally I'm fine with fh
.
The other messages was about "too few public methods" and "no self use, could be a function" probably smells for great changes, related to Issue #87.
When did you get the too few public methods? Probably they can be fixed with the @staticmethod
decorator. Have you tried? — IMHO this bit doesn't have to do with #87, but the other warning has ; )
Should I change bump version?
Sure thing (thanks for the heads up @lipemorais)
print("While fetching, Seranata Toolbox didn't find file: {} \n{}".format(file_path, http_error_exception)) | ||
print("While fetching, Seranata Toolbox didn't find file: {} \n{}".format( | ||
file_path, | ||
http_error_exception)) |
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 feels like you missed one space, and we have a matter os style:
Either…
print("While fetching, Seranata Toolbox didn't find file: {} \n{}".format(file_path,
http_error_exception))
…or…
print("While fetching, Seranata Toolbox didn't find file: {} \n{}".format(
file_path,
http_error_exception)
)
datasets_format = 'datasets-format.html' | ||
url = ( | ||
'http://www2.camara.leg.br/transparencia/cota-para-exercicio-da-atividade-parlamentar/' | ||
'explicacoes-sobre-o-formato-dos-arquivos-xml') |
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.
Style, either…
url = (
'part1'
'part2'
)
…or…
url = ('part1'
'part2')
print("While fetching, Seranata Toolbox didn't find file: {} \n{}".format(file_path, url_error_exception)) | ||
print("While fetching, Seranata Toolbox didn't find file: {} \n{}".format( | ||
file_path, | ||
url_error_exception)) |
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 feels like you missed one space, and we have a matter os style:
Either…
print("While fetching, Seranata Toolbox didn't find file: {} \n{}".format(file_path,
url_error_exception))
…or…
print("While fetching, Seranata Toolbox didn't find file: {} \n{}".format(
file_path,
url_error_exception)
)
print("While translating, Seranata Toolbox didn't find file: {} \n{}".format(csv_path, file_not_found_error)) | ||
print("While translating, Seranata Toolbox didn't find file: {} \n{}".format( | ||
csv_path, | ||
file_not_found_error)) |
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 feels like you missed one space, and we have a matter os style:
Either…
print("While translating, Seranata Toolbox didn't find file: {} \n{}".format(file_path,
file_not_found_error))
…or…
print("While translating, Seranata Toolbox didn't find file: {} \n{}".format(
file_path,
file_not_found_error)
)
('Contratação de consultorias, assessorias, pesquisas, trabalhos técnicos e outros serviços' | ||
' de apoio ao exercício do mandato parlamentar'): | ||
('Recruitment of consultancies, advisory services, research, technical work and other services' | ||
' in support of the exercise of the parliamentary mandate'), |
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 a better option would be to define two tuples, one with the pt-BR version, another with the en-US version and finally build the dictionary with something like categories = dict(zip(pt_br, en_us))
.
Ow… another doubt:
|
pylint complains about classes having less than two public methods and the datasets classes have just fetch as public.
In fact, on Landspcape.io appeared some "use list comprehension over map and filter" that prospector doesn't show up. I removed the test that was testing the size of the resultset (thanks to discussion with @rennerocha on telegram) |
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.
IMHO removing a test should not be part of a PR targeting code style and health reports. What do you think?
@@ -20,7 +20,6 @@ def test_fetch(self): | |||
'canceled', 'report_status', 'report_details_link' | |||
] | |||
self.assertTrue(np.array_equal(expectedColumns, actualColumns)) | |||
self.assertEqual(56, len(df)) |
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 totally agree that this test is a problem per se. However just for maintainability sake and for the community to follow the work on the project I'm not in favor of “smuggling” this change in the middle of a PR related to something else (code quality, health etc.).
There is a greater discussion about the role of tests in the project going on.
Would you mind reverting this change and let this to another PR/discussion?
BTW your commits are larger than I would recommend: not in terms of amount of changes, but in the purpose of the changes committed:
- ace718d: identified static methods and removed test that doesn't make sense anymore
- d2c4622: fixed spaces according to pep8 e128 and updated minor patch
In the first one listed you committed this change together with another unrelated change, so you cannot use git revert
or git rebase
to fix that. In the second is some other PR gets merged first, you cannot use git
to revert a version bump… In general my advice is: if your commit message is X and Y you should commit twice: first commit X and then commit Y ; )
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 do agree. :)
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 removed the test with the thought that I was removing unused code as part of the project health. But I agree, it was bad and it is not consistent with others changes.
Oh, that's true. The commits are terrible.
I will fix that and come back
Thank you and srry for the trouble, like I told @lipemorais, the project that is contributing to me hahaha
What is the purpose of this Pull Request?
Improve the project health
What was done to achieve this purpose?
Code smells pointed out by prospector was removed/fixed as like some styles that wasn't right according to pep8 style guide
How to test if it really works?
Running
prospector -s veryhigh --max-line-length 120 serenata_toolbox
, it was pointed out 60 problems, now it is showing 30 (details about later).EDIT: now 22, thanks to @lipemorais and @cuducos
Who can help reviewing it?
@lipemorais and anybody who wants it =))
TODO
why i didn't solve the last 30 remaining:
13 invalid-name "df" - I think the readability of "df" is just fine, (i don't have exp) but seems that it is a common practice (maybe change to what_this_df_is_about_df?)
1 invalid-name "s3" - it is literal I think.
1 invalid-name "fh" - I couldn't understand what it means, so I couldn't think a valid name for it.
The other messages was about "too few public methods" and "no self use, could be a function" probably smells for great changes, related to Issue #87.
Landscape pointed out two more things that prospector didn't, list comprehension over filter and map functions, I changed just a map function for readability (I think), list comprehension over filters make it verbose and not more readable (if it seems inconsistency, let me know).
Should I change bump version?