Skip to content
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

Introduce flake8-print as pre-commit hook with migration of print to logger #11994

Merged
merged 7 commits into from
Mar 17, 2024

Conversation

thesujai
Copy link
Contributor

Summary

  • Add flake8-print:3.1.4 which is back-compatible with py2.7
  • Removes use of print with logger

References

Fixes #11990

Reviewer guidance


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... DEV: tools Internal tooling for development SIZE: medium labels Mar 15, 2024
Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

We also specify the flake8 version in our dev requirements, so would be good to add the flake8-print plugin there too: https://github.com/learningequality/kolibri/blob/develop/requirements/dev.txt#L3

@@ -6,6 +6,7 @@
import tempfile
import time
import zipfile
from builtins import FileNotFoundError
Copy link
Member

Choose a reason for hiding this comment

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

I have good news - we no longer support Python 2.7 on develop, so we don't need to do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it! I was wondering why its giving me error. Turns out i was in py2.7 venv 😆

@@ -5,6 +5,9 @@ repos:
hooks:
- id: trailing-whitespace
- id: flake8
additional_dependencies: [
'flake8-print==3.1.4'
Copy link
Member

Choose a reason for hiding this comment

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

We should be able to use flake8-print==5.0.0, as we are no longer supporting Python 2.7 on develop!

Note that with version 5, they changed the codes to T2* not T0*.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yesss, sure

@rtibbles
Copy link
Member

Thank you, this all looks good to me!

@rtibbles rtibbles merged commit ff2357b into learningequality:develop Mar 17, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEV: backend Python, databases, networking, filesystem... DEV: tools Internal tooling for development SIZE: medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pre-commit hooks not looking out for print statements
2 participants