Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Linting #150

Merged
merged 21 commits into from
Jan 19, 2020
Merged

Linting #150

merged 21 commits into from
Jan 19, 2020

Conversation

herrboyer
Copy link
Contributor

@herrboyer herrboyer commented Jan 10, 2020

Fixes #148

  • format using black
  • setup flake8 (setup.cfg, dev requirements)
  • setup CI (add a lint stage)
  • lint pymarc modules
  • lint tests
  • write docs about linting and settings used

@herrboyer herrboyer mentioned this pull request Jan 10, 2020
@edsu
Copy link
Owner

edsu commented Jan 12, 2020

@herrboyer let me know when you think this is ready and I will take a look.

@herrboyer
Copy link
Contributor Author

Hi @edsu sorry for the noise on this PR, I had some problems with Travis... I think I'm done with the linting, let me know what you think.

About the last item on the checklist, would adding a few words in a CONTRIBUTING.md file be OK with you ?

@herrboyer
Copy link
Contributor Author

In fact I think that the information on the linter have more their place in the documentation ... The contribution guide is a little too vast for me to approach it on this PR ...

Somehow I went overboard and did a reorganization of the documentation in the last commit (same content, but in a single page and a I think better ToC). Let me know @edsu if I should rollback.

@herrboyer
Copy link
Contributor Author

Well, now I think I'm done @edsu, looking forward to reading your feedback !

@herrboyer herrboyer changed the title WIP: linting Linting Jan 14, 2020
@edsu
Copy link
Owner

edsu commented Jan 15, 2020

@herrboyer this is an incredible amount of cleanup, thank you for doing it! Adding a CONTRIBUTING.md file would be useful yes if you still have the energy for that. Were you thinking that's where details could go about how to lint? I hadn't seen black before, so I'll be interested to see how it works in practice for my other projects.

@edsu
Copy link
Owner

edsu commented Jan 15, 2020

Oh, I see the new Contributing section in the docs. Did you think that would work better as a separate file in the root? I worry that it might get a bit lost in the docs.

And thanks to @Wooble I see that black is smart enough to fix the problems it finds :-) So maybe it wasn't so much work for you to do, but I still appreciate the time you spent adding it.

.travis.yml Outdated
- stage: lint
name: "Check linting with flake8"
install: pip install -r requirements.dev.txt
script: find . -name \*.py -exec flake8 {} +
Copy link
Owner

Choose a reason for hiding this comment

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

Could this be simplified as:

script: flake8 pymarc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we also need to lint the test module, and maybe other python files in the project's root (like the apply_licence_header proposed by dan), but I agree this was too complex, I've committed this, would it be better ?

    - stage: lint
      name: "Check linting with flake8"
      install: pip install -r requirements.dev.txt
      script: flake8 .
    - stage: lint
      name: "Check format with black"
      install: pip install -r requirements.dev.txt
      script: black --quiet --diff .

.travis.yml Outdated
- stage: lint
name: "Check format with black"
install: pip install -r requirements.dev.txt
script: find . -name \*.py -exec black --quiet --diff {} +
Copy link
Owner

Choose a reason for hiding this comment

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

Could this be simplified as:

script: black --quiet --diff pymarc

It doesn't look like black will exit non-zero, so when it runs across errors it will simply print out some diffs and the build will continue? Is this really serving any purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My mistake, forgot the --check flag, fixed by dddca14

@herrboyer
Copy link
Contributor Author

herrboyer commented Jan 16, 2020

And thanks to @Wooble I see that black is smart enough to fix the problems it finds :-) So maybe it wasn't so much work for you to do, but I still appreciate the time you spent adding it.

Yes black was able to apply all the formatting rules, it's a wonderful tool. Most of my time was spent on making flake8 happy (doctrings, unused imports/variables, etc.)

@herrboyer
Copy link
Contributor Author

herrboyer commented Jan 16, 2020

Oh, I see the new Contributing section in the docs. Did you think that would work better as a separate file in the root? I worry that it might get a bit lost in the docs.

Well I hesitated a bit about this, but you're right, it's a bit lost after the api docs... Moved it to the standard CONTRIBUTING.md file here 6800d5d

@edsu edsu merged commit 6d89c6e into edsu:master Jan 19, 2020
@edsu
Copy link
Owner

edsu commented Jan 19, 2020

🙌

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linting
2 participants