Skip to content

Commit

Permalink
Fixed style and documentation issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Jan 10, 2024
1 parent e2dbe8c commit dd6691f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 20 deletions.
3 changes: 3 additions & 0 deletions doc/Glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Glossary
Code Coverage
tbd

doc-string
tbd

Documentation Coverage
tbd

Expand Down
10 changes: 5 additions & 5 deletions sphinx_reports/CodeCoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ def _ConvertToColor(self, currentLevel, configKey):
for levelLimit, levelConfig in self._levels.items():
if (currentLevel * 100) < levelLimit:
return levelConfig[configKey]
else:
return self._levels[100][configKey]

return self._levels[100][configKey]

def _GenerateCoverageTable(self) -> nodes.table:
# Create a table and table header with 5 columns
table, tableGroup = self._PrepareTable(
id=self._packageID,
identifier=self._packageID,
columns={
"Filename": 500,
"Total": 100,
Expand Down Expand Up @@ -189,10 +189,10 @@ def renderlevel(tableBody: nodes.tbody, packageCoverage: PackageCoverage, level:

return table

def _CreateLegend(self, id: str, classes: Iterable[str]) -> List[nodes.Element]:
def _CreateLegend(self, identifier: str, classes: Iterable[str]) -> List[nodes.Element]:
rubric = nodes.rubric("", text="Legend")

table = nodes.table("", id=id, classes=classes)
table = nodes.table("", id=identifier, classes=classes)

tableGroup = nodes.tgroup(cols=2)
table += tableGroup
Expand Down
14 changes: 7 additions & 7 deletions sphinx_reports/DocCoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ def _ConvertToColor(self, currentLevel, configKey):
for levelLimit, levelConfig in self._levels.items():
if (currentLevel * 100) < levelLimit:
return levelConfig[configKey]
else:
return self._levels[100][configKey]

return self._levels[100][configKey]

def _GenerateCoverageTable(self) -> nodes.table:
# Create a table and table header with 5 columns
table, tableGroup = self._PrepareTable(
id=self._packageID,
identifier=self._packageID,
columns={
"Filename": 500,
"Total": 100,
Expand Down Expand Up @@ -191,10 +191,10 @@ def renderlevel(tableBody: nodes.tbody, packageCoverage: PackageCoverage, level:

return table

def _CreateLegend(self, id: str, classes: Iterable[str]) -> List[nodes.Element]:
def _CreateLegend(self, identifier: str, classes: Iterable[str]) -> List[nodes.Element]:
rubric = nodes.rubric("", text="Legend")

table = nodes.table("", id=id, classes=classes)
table = nodes.table("", id=identifier, classes=classes)

tableGroup = nodes.tgroup(cols=2)
table += tableGroup
Expand Down Expand Up @@ -236,11 +236,11 @@ def run(self):
container = nodes.container()

if LegendPosition.Top in self._legend:
container += self._CreateLegend(id="legend1", classes=["doccov-legend"])
container += self._CreateLegend(identifier="legend1", classes=["doccov-legend"])

container += self._GenerateCoverageTable()

if LegendPosition.Bottom in self._legend:
container += self._CreateLegend(id="legend2", classes=["doccov-legend"])
container += self._CreateLegend(identifier="legend2", classes=["doccov-legend"])

return [container]
4 changes: 2 additions & 2 deletions sphinx_reports/Sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def _ParseLegendOption(self, optionName: str, default: Nullable[LegendPosition]
except KeyError as ex:
raise ReportExtensionError(f"{self.directiveName}::{optionName}: Value '{option}' is not a valid member of 'LegendPosition'.") from ex

def _PrepareTable(self, columns: Dict[str, int], id: str, classes: List[str]) -> Tuple[nodes.table, nodes.tgroup]:
table = nodes.table("", id=id, classes=classes)
def _PrepareTable(self, columns: Dict[str, int], identifier: str, classes: List[str]) -> Tuple[nodes.table, nodes.tgroup]:
table = nodes.table("", identifier=identifier, classes=classes)

tableGroup = nodes.tgroup(cols=(len(columns)))
table += tableGroup
Expand Down
10 changes: 5 additions & 5 deletions sphinx_reports/Unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ def _ConvertToColor(self, currentLevel, configKey):
for levelLimit, levelConfig in self._levels.items():
if (currentLevel * 100) < levelLimit:
return levelConfig[configKey]
else:
return self._levels[100][configKey]

return self._levels[100][configKey]

def _GenerateCoverageTable(self) -> nodes.table:
# Create a table and table header with 5 columns
table, tableGroup = self._PrepareTable(
id=self._packageID,
identifier=self._packageID,
columns={
"Filename": 500,
"Total": 100,
Expand Down Expand Up @@ -189,10 +189,10 @@ def renderlevel(tableBody: nodes.tbody, packageCoverage: PackageCoverage, level:

return table

def _CreateLegend(self, id: str, classes: Iterable[str]) -> List[nodes.Element]:
def _CreateLegend(self, identifier: str, classes: Iterable[str]) -> List[nodes.Element]:
rubric = nodes.rubric("", text="Legend")

table = nodes.table("", id=id, classes=classes)
table = nodes.table("", id=identifier, classes=classes)

tableGroup = nodes.tgroup(cols=2)
table += tableGroup
Expand Down
2 changes: 1 addition & 1 deletion sphinx_reports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ReportDomain(Domain):
* *None*
.. rubric:: Configuration variables
.. rubric:: Configuration variables
All configuration variables in :file:`conf.py` are prefixed with ``report_*``:
Expand Down

0 comments on commit dd6691f

Please sign in to comment.