Skip to content

Use flake8-docstrings to run pydocstyle via flake8 - #1202

Merged
peterjc merged 19 commits into
biopython:masterfrom
peterjc:flake8
May 4, 2017
Merged

peterjc merged 19 commits into
biopython:masterfrom
peterjc:flake8

Conversation

@peterjc

@peterjc peterjc commented May 1, 2017

Copy link
Copy Markdown
Member

This would close #1199

It replaces the central .pydocstyle configuration file for pydocstyle with top-level folder specific .flake8 entries used with flake8-docstrings via flake8 instead.

Our long term goal should be to unify on a single base-level .flake8 file for the entire project, but right now this setup allows e.g. BioSQL/ and Scripts/ to be more strictly checked until Bio/ and Tests/ catch up.

@peterjc

peterjc commented May 1, 2017

Copy link
Copy Markdown
Member Author

Inviting comments, esp from @bow, @MarkusPiotrowski and @morrme

@peterjc

peterjc commented May 1, 2017

Copy link
Copy Markdown
Member Author

Also CC @cbrueffer as he's worked on the git-commit hook side of things.

@codecov

codecov Bot commented May 1, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #1202 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1202      +/-   ##
==========================================
- Coverage   79.95%   79.94%   -0.01%     
==========================================
  Files         323      323              
  Lines       51477    51478       +1     
==========================================
- Hits        41157    41156       -1     
- Misses      10320    10322       +2
Impacted Files Coverage Δ
BioSQL/BioSeq.py 91.05% <ø> (ø) ⬆️
BioSQL/BioSeqDatabase.py 76.36% <ø> (ø) ⬆️
BioSQL/Loader.py 78.74% <ø> (ø) ⬆️
Bio/Align/Applications/_ClustalOmega.py 100% <ø> (ø) ⬆️
Bio/motifs/applications/_xxmotif.py 100% <ø> (ø) ⬆️
BioSQL/DBUtils.py 79.45% <100%> (+0.28%) ⬆️
BioSQL/__init__.py 100% <100%> (ø) ⬆️
Bio/NeuralNetwork/Gene/Schema.py 71.07% <0%> (-0.83%) ⬇️

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 624b206...28212e4. Read the comment docs.

@peterjc

peterjc commented May 1, 2017

Copy link
Copy Markdown
Member Author

There is currently a major catch to watch out for - right now flake8 and/or flake8-docstrings breaks if there is a trailing comma on the ignore list:

https://gitlab.com/pycqa/flake8/issues/330

@peterjc

peterjc commented May 1, 2017

Copy link
Copy Markdown
Member Author

Locally I've been using flake8 and pycodestyle installed under Python 3, which means certain differences in the output (like ignoring D302). Right now TravisCI is only running the style checks under Python 2, we'll do both later.

@bow bow 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.

Hi @peterjc,

I went through the changes and noticed some small typos. Other than those, the changeset looks good for merge.

Comment thread Scripts/Restriction/ranacompiler.py Outdated
True is the sequence is a palindrom.
sequence is a Seq object.
"""
"""Is the sequence (Seq objecT) as a palindrom."""

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.

I feel this is better phrased as "Whether the sequence is a palindrome or not." (also there is a typo in the end currently)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In imperative mood: "Check wether the sequence is a palindrome or not."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you. Should we change the method name too (is_palindrome with an e)?

@bow bow May 2, 2017 •

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.

That would be good. Something like:

def is_palindrom(...):
    # ... deprecation notice here? I'm not sure if this is overkill since this is a small function ... 
    return is_palindrome(...)

def is_palindrome(...):
    # actual function

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done, thank you.

Comment thread Tests/test_MafIO_index.py Outdated

def test_correct_retrieval_1(self):
"""
"""Correct retrievel of Cnksr3 in mouse.

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 should be "Correct retrieval ..."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you, fixing.

peterjc added a commit to peterjc/biopython that referenced this pull request May 2, 2017
@peterjc

peterjc commented May 2, 2017

Copy link
Copy Markdown
Member Author

Frustratingly I didn't have a pre-commit hook installed on this machine...

@peterjc

peterjc commented May 2, 2017

Copy link
Copy Markdown
Member Author

I have updated my git pre-commit hook on #1188 to assume just .flake8 configuration.

@peterjc

peterjc commented May 4, 2017

Copy link
Copy Markdown
Member Author

Thank you @bow & @MarkusPiotrowski for looking at this.

I've just rebased with a slight history clean up; if this passes TravisCI I will merge it...

@peterjc
peterjc merged commit ebbb304 into biopython:master May 4, 2017
@peterjc
peterjc deleted the flake8 branch May 4, 2017 16:23
MarkusPiotrowski pushed a commit to MarkusPiotrowski/biopython that referenced this pull request Oct 31, 2017
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.

Adopt flake8-docstrings to run pydocstyle via flake8

3 participants