Skip to content

Conversation

annashtirberg
Copy link
Contributor

this is for Add git hooks for pre-commit flake8 #196
Used pre-commit for adding git hooks before doing commit
The hooks do flake8 checks like in the github actions
Also did yapf for making the code look good and fit flake8 style

2. [Python](https://www.python.org/downloads/release/python-385/)
3. Install pre-commit hooks:
```shell
pre-commit install
Copy link
Member

Choose a reason for hiding this comment

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

This comment doesn't work on my shell. Maybe it requires some another prerequisite?

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 changed it and I think it will work for you (and everyone else too) now :)

Copy link
Member

Choose a reason for hiding this comment

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

image
^^"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but I change it, ok now it is correct
you need to install the requirements before

Copy link
Member

Choose a reason for hiding this comment

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

Maybe you've changed the requirements.txt and forgot to push it?

Currently I don't have anything in the requirements.txt that installs the pre-commit command, unfortunately :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh no, your right, my mistake
I fixed it now

@annashtirberg annashtirberg marked this pull request as ready for review February 9, 2021 12:29
@annashtirberg
Copy link
Contributor Author

The hooks need to be installed.
The way to do it is like this:

  1. pip install -r requirements.txt (install all requirements)
  2. pre-commit install (install git hooks)

After this every commited file will be checked for style and also fixed if possible
If flake8 don't like your file the commit will fail and print flake8 errors to fix
If yapf changed your file the commit will fail and the file will need to "git add" again

Hope it will help everyone :)


event = create_event(session, title, start, end, owner_id, content,
location, invited_emails, category_id=category_id)
event = create_event(session,
Copy link
Contributor

Choose a reason for hiding this comment

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

please revert thie change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

went back to original, sorry

start_format = '%A, %d/%m/%Y %H:%M'
end_format = ('%H:%M' if event.start.date() == event.end.date()
else start_format)
end_format = ('%H:%M'
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the prev format was more readable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

went back to original, sorry



def create_event(db: Session, title: str, start, end, owner_id: int,
def create_event(db: Session,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please revert this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

went back to original, sorry

2. [Python](https://www.python.org/downloads/release/python-385/)
3. Install pre-commit hooks:
```shell
pre-commit install
Copy link
Member

Choose a reason for hiding this comment

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

image
^^"

2. [Python](https://www.python.org/downloads/release/python-385/)
3. Install pre-commit hooks:
```shell
pre-commit install
Copy link
Member

Choose a reason for hiding this comment

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

Maybe you've changed the requirements.txt and forgot to push it?

Currently I don't have anything in the requirements.txt that installs the pre-commit command, unfortunately :(

@codecov-io
Copy link

codecov-io commented Feb 11, 2021

Codecov Report

Merging #224 (36438cb) into develop (93ae431) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #224   +/-   ##
========================================
  Coverage    99.40%   99.40%           
========================================
  Files           47       47           
  Lines         2171     2171           
========================================
  Hits          2158     2158           
  Misses          13       13           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 93ae431...9533f32. Read the comment docs.

@yammesicka yammesicka merged commit 04da9b0 into PythonFreeCourse:develop Feb 11, 2021
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