Skip to content

Configure flake8 and yapf with pre-commit#215

Merged
tapaswenipathak merged 5 commits into
OpenSourceHelpCommunity:predevfrom
vinaypuppal:precommit
Jan 1, 2018
Merged

Configure flake8 and yapf with pre-commit#215
tapaswenipathak merged 5 commits into
OpenSourceHelpCommunity:predevfrom
vinaypuppal:precommit

Conversation

@vinaypuppal

Copy link
Copy Markdown
Contributor

Checklist

  • My branch is up-to-date with the upstream develop branch.
  • I have added necessary documentation (if appropriate).

Which issue does this PR fix?:
fixes #130

Why do we need this PR?:
To ensure that all the code we write follows the standard convention.

What is the new behavior?

  • Configured Flake8 linter.
  • Configured yapf (a python code formatter from google).
  • Configured pre-commit so flake8 and yapf are run for every git commit.
  • Updated Readme on how to install pre-commit hooks.
  • Updated travis.yml to run all precommit-hooks on changed files

Testing instructions:

  1. Change some file/s in codebase.
  2. Add file/s to staging.
  3. Commit file/s to git.
  4. If there is some linting or formatting issue then committing will be stopped.
  5. If its formatting issue yapf will make changes in place so add changed files to staging again and run git commit agin.
    screen shot 2017-12-25 at 22 35 12
    screen shot 2017-12-25 at 22 35 39
  6. If its lint issue fix them, add changed files to staging again and run git commit agin.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 72.269% when pulling 4586475 on vinaypuppal:precommit into ea6096f on OpenSourceHelpCommunity:predev.

Comment thread .pre-commit-config.yaml
exclude: '^$'
fail_fast: true
repos:
- repo: https://github.com/pre-commit/mirrors-yapf

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This does not seem to be v. actively used and maintained, what do you think about enabling without mirror?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This does not seem to be v. actively used and maintained

I am curious how did you decide this?

I see https://github.com/pre-commit/mirrors-yapf is updated whenever yapf(https://github.com/google/yapf/releases) is updated as you can see here https://github.com/pre-commit/mirrors-yapf/releases

what do you think about enabling without mirror

@tapaswenipathak tapaswenipathak Jan 1, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This does not seem to be v. actively used and maintained

I am curious how did you decide this?

I see https://github.com/pre-commit/mirrors-yapf is updated whenever yapf(https://github.com/google/yapf/releases) is updated as you can see here https://github.com/pre-commit/mirrors-yapf/releases

Thanks for linking this, my observation was 👎 skipped over 53 releases. 👍

what do you think about enabling without mirror

We need to provide git repository to enable pre-commit hooks (Ref: http://pre-commit.com/#plugins)
o w/ the number of releases they had, don't need this.

So What you mean by without mirror?

☝️ what you understood, a fork of our own or code to enable a pre-commit hook.

Comment thread README.md
```

1. Run the app
```bash

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks for this cleanup! 🎉 I was planning to do this from quite a while but didn't.

Comment thread .flake8
# A continuation line is under-indented for a visual indentation.
E128

max-line-length=80 No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

..and moving it to separate dotfile is perfect!

@tapaswenipathak tapaswenipathak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for suggesting and than working on this, left a comment otherwise it is 🚀

@tapaswenipathak tapaswenipathak merged commit 921d353 into OpenSourceHelpCommunity:predev Jan 1, 2018
Comment thread README.md
cd oshc
```

1. Install [pre-commit](pre-commit.com) into your git hooks. [pre-commit](pre-commit.com) will now run on every commit. Every time you clone a project that is using [pre-commit](pre-commit.com) running [pre-commit](pre-commit.com) install should always be the first thing you do after installing requirements.

@tapaswenipathak tapaswenipathak Jan 1, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

in markdown it takes relative path if not put w/ the protocol, need a correction here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh, I missed protocol in URL somehow during copy-paste or maybe my editor removed them.

It seems you fixed it after merging, thanks.

@vinaypuppal vinaypuppal deleted the precommit branch January 2, 2018 06:44
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.

Add a pre-linting file

3 participants