Comments (8)
This issue is probably a blocker for #91.
from pydocstyle.
I would like to see pep257 using the same arg/config names as pep8 , and use roughly the same order of precedence of applying those args/config. Ideally this becomes a shareable library , so new tools can provide the same configuration options, and their code & time can focus on the linting rules. (flake8 does provide some level of normalisation across these tools, but it would be better they didnt all behave so differently on the cmdline)
from pydocstyle.
This looks fine to me.
from pydocstyle.
π
from pydocstyle.
I know I'm a bit late for the party, but I just want to mention this as this bug has been referenced in #91 in which I'm interested.
I find the mutually exclusive error codes handling cumbersome because if one of them is selected you need to disable one and enable the other. So quickly testing with the other mode involves to mention two codes. I'm not sure if it couldn't automatically ignore colliding codes implicitly. Unfortunately there are no examples for mutually exclusive error codes (afaik) so there is probably no current solution.
Regarding #91 which mentioned this bug, it seems like the issue there is a bit different from this here. If there are two different codes, one for 1 line separation and one for 0 lines separation they are not strictly exclusive (you could allow both separations). But especially when looking at that pull request, a new system could allow βoptionsβ for each specific code. This doesn't mean that the commands suggested here does need to provide this functionality as I've suggested some alternatives.
By the way there are a few inconsistencies in the examples above, which don't really pose a problem to be bug itself but may be (or in one case are still to me) confusing:
- Section 4: The introduction says D100 and D101 are exclusive but the list and examples use D101 and D102.
- Section 4: The sentence βPEP257 uses D100 (so it's on by default)β sounds superfluous compared to the list below it. As D100 is the only mentioned rule it sounds like D100 is some how special but it's not clear to me how. Is D100 always enabled so even if you choose
--convention numpy
it's enabled unlessnumpy
specifically disables it? This seems counter intuitive to the--convention
parameter which should afaik just be like a default list of selected xor ignored codes (basically a shortcut). - Section 4.2: Uses
--add-ignore=D104
to enable D104. I think you meant--add-select
. - Section 4.6: Uses
--add-ignore=D103
to ignores D103 which is selected innumpy
by default but header mentions D104.
from pydocstyle.
@xZise I think the main point of difference is your sentence:
If there are two different codes, one for 1 line separation and one for 0 lines separation they are not strictly exclusive (you could allow both separations).
I disagree. If one error is for not having exactly 1 line breaks and one for not having exactly 0 line breaks, they are mutually exclusive. If you want to allow both, simply ignore both error codes. This will allow you to put any number of line breaks before class docstrings. I understand that you may want an option that allows 0 or 1 line breaks, but I don't think such an option is sensible in the same way that we don't allow other "count" issues to be configured. Standards are a way to make code look similar. If you allow to choose between several ways of doing something, it isn't really a standard.
Your comments about the inaccuracies of this issues are correct and will be edited.
from pydocstyle.
Well the main reason to allow both is to allow a conversion time where the number may be 0 or 1 (but nothing else, which is not possible when we ignore both codes). In fact for Jenkins flake8 validation on pywikibot there could be two different tests. One non-voting one allow only 0 (the new standard) one one voting one allow both. Over time it'll drift towards 0 as new classes should follow the new style.
Now in the specific case of #91 there is only one additional line so in theory it would be possible to fix all at once relatively easy by just removing one newline. But other future changes to PEP257 might be more complex where it would be advantageous to support both the old and new standard.
from pydocstyle.
I understand your position, but I believe that disabling both error codes for the transition is good enough, and a reasonable trade-off to keep a sensible and consistent error model. Your last paragraph seems to actually support this case. Other future change might be more complex in a way that treating each one of them with a specialized flag will bloat the script. They may also be more explicitly mutually exclusive, so this problem might happen again in the future.
My current strategy is this:
- All error codes from all convention are included in a big list.
- If more than one convention includes the same "rule", there will be only one error code representing it.
- If there is a similar "rule" for several conventions, but the "configuration" is different (such as in this case), it should be reflected in multiple error codes.
- Error codes may conflict.
- The user can choose whichever error codes he wants from the list, as long as they are not mutually exclusive.
- The default checked error codes are those in the most recent version of the PEP257 document.
from pydocstyle.
Related Issues (20)
- option to ban `noqa` comments that don't specify a code
- D102 - false positive on overload with comment
- cosmetic bug: wrong version stamp in webpage title: 1.0.0 instead of 2.1.1
- The match-dir parameter is not used. HOT 4
- Not detecting wrong DocStrings HOT 1
- Your website is down - https://pydocstyle.org HOT 3
- Crash with simple f-string HOT 7
- Docs website is down? HOT 1
- sdist: PKG-INFO should list LICENSE-MIT in License-File
- `D300` and `D301` false positives on docstrings with escaped triple quotes in them
- Should `__main__.py` really be considered a public module?
- Option to not report error for empty file HOT 1
- test_simple_fstring and test_fstring_with_args fail with Python 3.12 beta HOT 2
- 6.3.0: incorrect version in pyproject.toml?π€ HOT 2
- pydocstyle 6.3.0 fails silently on a python script that has no .py extension
- Rule for missing PEP 698 `@overrides` decorators?
- Keyword Args not recognized in Google convention with no return
- Python3.12: Two tests fail HOT 1
- Google convention section names not properly checked
- D417 not raised in a standard Google configuration with missing arguments descriptions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pydocstyle.