Repository navigation
Option enumerations as StringEnum: VersionFormat, DependencyFormat, LegendStyle - #91
Conversation
Like DuplicateFormat, DuplicateMatch and LegendPosition: a StringEnum with
DEFAULT, whose Parse is the option converter. A document writes the values in
lower case with dashes:
:version-format: major | major-minor (default) | major-minor-patch | all
:dependency-format: package | package-version | package-license |
package-version-license (default)
The member names (MajorMinor, PackageVersionLicense) were accepted before,
case-insensitive; no project here uses the two options outside this
documentation. DependencyTable._ParseFormatOption, its TypeVar and the module
constants DEFAULT_VERSION_FORMAT and DEFAULT_DEPENDENCY_FORMAT are removed;
the enums' __str__ returning the member name is gone, a member is its value.
Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
LegendStyle was a Flag (Table, Horizontal, Vertical and the combinations horizontal_table/vertical_table), read by BaseDirective._ParseEnumOption, which lower-cased the value and turned dashes into underscores. Only the two combinations were ever chosen, so it is a StringEnum now, like the other option enumerations: HorizontalTable = "horizontal-table" (DEFAULT), VerticalTable = "vertical-table". Its Parse is the option converter of report:code-coverage-legend and report:doc-coverage-legend; documents keep writing ':style: vertical-table'. The directives compare the member instead of testing bits. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
Its only callers were the two coverage legends, which read LegendStyle with its Parse as option converter now. No other repository uses it. The TypeVar _EnumType and the imports of Enum, Flag and TypeVar go with it. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | -15 |
| Duplication | 0 |
🟢 Coverage 83.33% diff coverage · +0.15% coverage variation
Metric Results Coverage variation ✅ +0.15% coverage variation (-1.00%) Diff coverage ✅ 83.33% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (c731b8b) 5236 4653 88.87% Head commit (2323623) 5197 (-39) 4626 (-27) 89.01% (+0.15%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#91) 30 25 83.33% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #91 +/- ##
==========================================
+ Coverage 86.95% 87.14% +0.19%
==========================================
Files 24 24
Lines 5236 5197 -39
Branches 839 833 -6
==========================================
- Hits 4553 4529 -24
+ Misses 583 571 -12
+ Partials 100 97 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Changes
pyTooling.Sphinx.DependencyTable:VersionFormatandDependencyFormatareStringEnums withDEFAULT, likeDuplicateFormat,DuplicateMatchandLegendPosition; theirParseis the option converter. A document writes the values in lower case with dashes::version-format: major | major-minor | major-minor-patch | all, defaultmajor-minor.:dependency-format: package | package-version | package-license | package-version-license, defaultpackage-version-license.MajorMinor,PackageVersionLicense) were accepted before, case-insensitive. No repository uses the two options outside this documentation.DependencyTable._ParseFormatOption, the module constantsDEFAULT_VERSION_FORMATandDEFAULT_DEPENDENCY_FORMAT(VersionFormat.DEFAULT,DependencyFormat.DEFAULT), and the enumerations'__str__returning the member's name - a member is its value now.pyTooling.Sphinx:LegendStyleis aStringEnum:HorizontalTable = "horizontal-table"(DEFAULT) andVerticalTable = "vertical-table". It was aFlag(Table,Horizontal,Verticaland the combinationshorizontal_table/vertical_table), of which only the two combinations were ever chosen. Documents keep writing:style: vertical-table.BaseDirective._ParseEnumOptionis removed: its only callers were the two coverage legends. No other repository uses it.pyTooling.Sphinx.CodeCoverage,pyTooling.Sphinx.DocCoverage:report:code-coverage-legendandreport:doc-coverage-legendread:style:withLegendStyle.Parseand compare the member instead of testing bits.StringEnum.Parse's note), instead of aSphinxExtensionErrorwhile the directive runs.Documentation
:version-format:and:dependency-format:.Unit Tests
tests/unit/DependencyTable.py: the defaults ofVersionFormatandDependencyFormatviaParse(None); their values, and the old member spelling rejected with the allowed values (replaces the test of__str__).tests/unit/Reports.py: new testsuite Coverage legend style: the default and the values,vertical_tablerejected.Related Issues and Pull-Requests
DuplicateFormatandDuplicateMatchasStringEnums (review), which raised the question for the older enumerations.LegendPosition, the first option enumeration asStringEnum.