Skip to content

Commit 4dddfcb

Browse files
committed
Run pep8 and pylint in test target, clean up code
1 parent d163d86 commit 4dddfcb

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ install:
99

1010
test:
1111
rm -rf out
12+
pep8 sphinx_tabs/tabs.py
13+
pip install pylint
14+
pylint --rcfile=pylint.cfg sphinx_tabs/tabs.py
1215
sphinx-build -E -n -W test test-output
1316

1417
clean:

pylint.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[REPORTS]
2+
reports=no

sphinx_tabs/tabs.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
""" Tabbed views for Sphinx, with HTML builder """
2+
13
import os
24
from docutils.parsers.rst import Directive
35
from docutils import nodes
@@ -11,9 +13,12 @@
1113

1214

1315
class TabsDirective(Directive):
16+
""" Top-level tabs directive """
17+
1418
has_content = True
1519

1620
def run(self):
21+
""" Parse a tabs directive """
1722
self.assert_has_content()
1823
env = self.state.document.settings.env
1924

@@ -40,9 +45,12 @@ def run(self):
4045

4146

4247
class TabDirective(Directive):
48+
""" Tab directive, for adding a tab to a collection of tabs """
49+
4350
has_content = True
4451

4552
def run(self):
53+
""" Parse a tab directive """
4654
env = self.state.document.settings.env
4755
self.assert_has_content()
4856
text = '\n'.join(self.content)
@@ -59,6 +67,7 @@ def run(self):
5967

6068

6169
def add_assets(app):
70+
""" Add CSS and JS asset files """
6271
for path in FILES:
6372
if '.css' in path:
6473
app.add_stylesheet(path)
@@ -67,6 +76,7 @@ def add_assets(app):
6776

6877

6978
def copy_assets(app, exception):
79+
""" Copy asset files to the output """
7080
if app.builder.name != 'html' or exception:
7181
return
7282
app.info('Copying tabs assets... ', nonl=True)
@@ -78,7 +88,8 @@ def copy_assets(app, exception):
7888

7989

8090
def setup(app):
81-
app.add_directive('tabs', TabsDirective)
82-
app.add_directive('tab', TabDirective)
91+
""" Set up the plugin """
92+
app.add_directive('tabs', TabsDirective)
93+
app.add_directive('tab', TabDirective)
8394
app.connect('builder-inited', add_assets)
8495
app.connect('build-finished', copy_assets)

0 commit comments

Comments
 (0)