Giter Site home page Giter Site logo

Comments (10)

sigmavirus24 avatar sigmavirus24 commented on July 23, 2024

So no(qa|pep8) is easily the biggest regret of the flake8/pep8 projects. We refuse to allow it to silence every error and that decision angers users who like to write terrible code. I'm not sure there's a good reason to add this. It might be nice to have, but the doc-string requirements are relaxed enough that I don't see any particular rule that necessitates this. I work on large projects like OpenStack where noqa is particularly abused and it leads to really inconsistent code-bases where tools like flake8 are supposed to help guide the code and its developers towards a relatively consistent practice.

What particular errors are causing you problems @jayvdb ?

from pydocstyle.

jayvdb avatar jayvdb commented on July 23, 2024

noqa is a tool; how it is used depends on the developers.

It is handy when migrating code to be compliant, which is something that pywikibot is slowly doing. We have a mandatory tox rule which we are add files to as we complete them, or they near completion and have a # noqa or two to help them across the line, so there cant be any regressions in compliance.

http://git.wikimedia.org/blob/pywikibot%2Fcore.git/b83e2e9e7dbf01800cc4b3bdef7f31d8ee775fdf/tox.ini#L32

We've encountered a few issues with pep257 itself (e.g. issue #78), some which were not even docstring related. We've had to add ugly hacks to our codebase because of pep257 , but we're all pretty keen on cleaning up the codebase, so it is a net positive ;-).

It would be preferable to be able to use # noqa to workaround pep257 problems, when they occur - until they are fixed and released and deployed onto our build machines, if a more elegant solution isnt available.

http://git.wikimedia.org/blob/pywikibot%2Fcore.git/b83e2e9e7dbf01800cc4b3bdef7f31d8ee775fdf/pywikibot%2F__init__.py#L65
http://git.wikimedia.org/blob/pywikibot%2Fcore.git/b83e2e9e7dbf01800cc4b3bdef7f31d8ee775fdf/pywikibot%2F__init__.py#L91

The main outstanding problem in pywikibot is exceptions which use the class docstring as the exception message. Changing that message is an interface change, so adding a '.' at the end of the class docstring should be a major version version, or we need to implement funky method of removing the '.' at runtime when the exception is raised.

http://git.wikimedia.org/blob/pywikibot%2Fcore.git/b83e2e9e7dbf01800cc4b3bdef7f31d8ee775fdf/pywikibot%2Fexceptions.py (search for noqa)

As another example, yesterday I tried to cleanup ez_setup.py, which is copied into many repos (including pywikibot), and met with resistance, which are mostly to do with personal taste wrt the pep257 fixes.

https://bitbucket.org/pypa/setuptools/pull-request/117/pep8-and-pep257-compliance/diff

IMO it is a good thing to push a module as far towards compliance as a maintainer is happy with, and noqa can help reach that objective - the maintainer has at least accepted that this line has problems in a lot of other peoples minds.

from pydocstyle.

oryband avatar oryband commented on July 23, 2024

👍 on request. any progress on this?

from pydocstyle.

Nurdok avatar Nurdok commented on July 23, 2024

@jayvdb - why isn't flake8's noqa directive satisfying your needs?
@oryband - this issue was opened just a couple of days ago and we haven't decided if it will be done yet.

from pydocstyle.

oryband avatar oryband commented on July 23, 2024

Any progress?

from pydocstyle.

jayvdb avatar jayvdb commented on July 23, 2024

@Nurdok this request is about pep257 and not flake8, which we cant run on pull requests from untrusted devs.

from pydocstyle.

Nurdok avatar Nurdok commented on July 23, 2024

@jayvdb I suggest you use a tool like TravisCI which can run flake8 on PRs in a safe environment. Other than that, if the purpose of this issue is to allow you to fix the code bit-by-bit, you can also use the error selection to enable only a closed set of checks, and add to it over time.

While I do understand the request for a per-line ignore and while I have not yet decided against it, it will probably not happen any time soon due to more pressing issues. If the errors you get are localized to few files, I would just ignore the entire files, for now.

from pydocstyle.

hvdklauw avatar hvdklauw commented on July 23, 2024

As someone who works with django I would like my classes to have docstrings, but it seems a bit silly to have it on the nested meta class.

Ideally I would like to see the errors for nested classes split from top level classes, but a noqa option would solve the issue too.

from pydocstyle.

Nurdok avatar Nurdok commented on July 23, 2024

@hvdklauw Seems reasonable. Can you open a separate issue for that?

from pydocstyle.

jayvdb avatar jayvdb commented on July 23, 2024

I forgot about this issue.
fwiw, my own need for this evaporated after Wikimedia CI allowed executing flake8, and I created https://github.com/jayvdb/flake8-putty so that I could disable specific codes per file & per line.

from pydocstyle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.