Skip to content

add pylintrc file to each indicator #365

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 15 commits into from
Oct 30, 2020
Merged

add pylintrc file to each indicator #365

merged 15 commits into from
Oct 30, 2020

Conversation

sgsmob
Copy link
Contributor

@sgsmob sgsmob commented Oct 23, 2020

This should make the linter complain less about:

  • Short variable names
  • Pytest naming/argument conventions

@sgsmob sgsmob requested a review from huisaddison October 26, 2020 12:43
@krivard
Copy link
Contributor

krivard commented Oct 26, 2020

It looks like this is using an identical .pylintrc for all indicators; the following modules had existing .pylintrc that have been overwritten. Was that intentional?

  • _delphi_utils_python
  • cds (can probably ignore this; cds is no longer being pursued)
  • google_health
  • jhu
  • nchs_mortality
  • quidel_covidtest
  • safegraph
  • safegraph_patterns
  • usafacts

@krivard krivard requested review from chinandrew and jingjtang and removed request for huisaddison October 26, 2020 21:17
too-many-arguments,
# Allow pytest functions to be part of a class.
no-self-use,
# Allow pytest classes to have one test.
Copy link
Contributor

Choose a reason for hiding this comment

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

this isn't scoped just to the test dir right? so adding these lines to have tests lint correctly potentially allows these into the actual module code?

secondarily, how strongly do we feel we need to lint unit tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, they would allow it into the module code, but they seem like narrow enough and innocuous enough problems that they could be caught in review.

If one uses an integrated linter in their IDE, it will read from these files and complain about the tests. FWIW we enforce style the same across implementation and test files.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a huge fan of relying on code review to catch problems that could have been linted, but agree they're pretty innocuous. One option is to add an additional pylintrc to the tests module, so any weird test things can get captured without worrying about affecting the module code. Not sure how clean that is though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about doing this but thought it created a lot of lint files (2 per indicator rather than the necessary 1). Can do if you think it is worthwhile.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea that's kind of annoying...I think they're pretty harmless for now, lets just leave as is.

@sgsmob
Copy link
Contributor Author

sgsmob commented Oct 27, 2020

It looks like this is using an identical .pylintrc for all indicators; the following modules had existing .pylintrc that have been overwritten. Was that intentional?

  • _delphi_utils_python
  • cds (can probably ignore this; cds is no longer being pursued)
  • google_health
  • jhu
  • nchs_mortality
  • quidel_covidtest
  • safegraph
  • safegraph_patterns
  • usafacts

Yes, I felt that we should have a consistent style across all indicators.

@krivard
Copy link
Contributor

krivard commented Oct 27, 2020

Yes, I felt that we should have a consistent style across all indicators.

Sounds good! In that case, would you do a pass through the ones below and make sure they lint successfully with the new configuration? Otherwise the next PR on their deploy-* branch will have surprise failures unrelated to the feature being added.

  • google_health
  • jhu
  • quidel_covidtest
  • safegraph
  • usafacts

@jingjtang
Copy link
Contributor

A quick check for google_health and quidel_covidtest, both of them run into linter errors. Most of the errors are due to C0103 (invalid-name), a few of them are due to E1101, W0212 etc.

Specially, W0212 results from protected-access to to member _load_crosswalk in GeoMapper. This should be discussed with @dshemetov to make _load_crosswalk public (or not).

@sgsmob
Copy link
Contributor Author

sgsmob commented Oct 28, 2020

Yes, I felt that we should have a consistent style across all indicators.

Sounds good! In that case, would you do a pass through the ones below and make sure they lint successfully with the new configuration? Otherwise the next PR on their deploy-* branch will have surprise failures unrelated to the feature being added.

  • google_health
  • jhu
  • quidel_covidtest
  • safegraph
  • usafacts

@krivard should I include the lint compliance changes in this PR?

@sgsmob sgsmob requested a review from krivard October 29, 2020 15:24
Copy link
Contributor

@krivard krivard left a comment

Choose a reason for hiding this comment

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

lgtm

@krivard krivard merged commit 8c73df3 into cmu-delphi:main Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants