Skip to content

Commit 9efdddb

Browse files
author
Release Manager
committed
gh-35819: advance the linter (add more checks) <!-- Please provide a concise, informative and self-explanatory title. --> <!-- Don't put issue numbers in the title. Put it in the Description below. --> <!-- For example, instead of "Fixes #12345", use "Add a new method to multiply two integers" --> ### 📚 Description this is adding a few checks to the pycodestyle linter, both for .py and .pyx files <!-- Describe your changes here in detail. --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x ]`. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #35819 Reported by: Frédéric Chapoton Reviewer(s): Matthias Köppe
2 parents 9d390f6 + f142ede commit 9efdddb

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"python.linting.enabled": true,
2828
// The following pycodestyle arguments are the same as the pycodestyle-minimal
2929
// tox environnment, see the file SAGE_ROOT/src/tox.ini
30-
"python.linting.pycodestyleArgs": ["--select= E111,E211,E271,E303,E306,E401,E502,E701,E702,E703,E714,W291,W293,W391,W605,E711,E712,E713,E721,E722"],
30+
"python.linting.pycodestyleArgs": ["--select= E111,E21,E222,E227,E251,E271,E303,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605"],
3131
"cSpell.words": [
3232
"furo",
3333
"Conda",

src/doc/en/website/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
html_static_path = [] + html_common_static_path
2222

2323
# General information about the project.
24-
project = "Documentation"
24+
project = "Documentation"
2525

2626
# The name for this set of Sphinx documents.
2727
html_title = project
@@ -33,8 +33,8 @@
3333
# Grouping the document tree into LaTeX files. List of tuples
3434
# (source start file, target name, title, author, document class [howto/manual]).
3535
latex_documents = [
36-
('index', 'sage_documentation.tex', 'Documentation',
37-
'The Sage Development Team', 'manual'),
36+
('index', 'sage_documentation.tex', 'Documentation',
37+
'The Sage Development Team', 'manual'),
3838
]
3939

4040
# Note that this effectively replaces the index.html generated from index.rst.

src/sage_docbuild/conf.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ def call_intersphinx(app, env, node, contnode):
716716
"""
717717
debug_inf(app, "???? Trying intersphinx for %s" % node['reftarget'])
718718
builder = app.builder
719-
res = intersphinx.missing_reference(
719+
res = intersphinx.missing_reference(
720720
app, env, node, contnode)
721721
if res:
722722
# Replace absolute links to $SAGE_DOC by relative links: this
@@ -738,7 +738,7 @@ def find_sage_dangling_links(app, env, node, contnode):
738738
debug_inf(app, "==================== find_sage_dangling_links ")
739739

740740
reftype = node['reftype']
741-
reftarget = node['reftarget']
741+
reftarget = node['reftarget']
742742
try:
743743
doc = node['refdoc']
744744
except KeyError:
@@ -754,17 +754,18 @@ def find_sage_dangling_links(app, env, node, contnode):
754754

755755
res = call_intersphinx(app, env, node, contnode)
756756
if res:
757-
debug_inf(app, "++ DONE %s"%(res['refuri']))
757+
debug_inf(app, "++ DONE %s" % (res['refuri']))
758758
return res
759759

760-
if node.get('refdomain') != 'py': # not a python file
760+
if node.get('refdomain') != 'py': # not a python file
761761
return None
762762

763763
try:
764764
module = node['py:module']
765-
cls = node['py:class']
765+
cls = node['py:class']
766766
except KeyError:
767-
debug_inf(app, "-- no module or class for :%s:%s"%(reftype, reftarget))
767+
debug_inf(app, "-- no module or class for :%s:%s" % (reftype,
768+
reftarget))
768769
return None
769770

770771
basename = reftarget.split(".")[0]
@@ -790,10 +791,10 @@ def find_sage_dangling_links(app, env, node, contnode):
790791
# adapted from sphinx/domains/python.py
791792
builder = app.builder
792793
searchmode = node.hasattr('refspecific') and 1 or 0
793-
matches = builder.env.domains['py'].find_obj(
794+
matches = builder.env.domains['py'].find_obj(
794795
builder.env, module, cls, newtarget, reftype, searchmode)
795796
if not matches:
796-
debug_inf(app, "?? no matching doc for %s"%newtarget)
797+
debug_inf(app, "?? no matching doc for %s" % newtarget)
797798
return call_intersphinx(app, env, node, contnode)
798799
elif len(matches) > 1:
799800
env.warn(target_module,

src/sage_setup/autogen/giacpy-mkkeywords.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@
7373
s+='\n You almost certainly want to use one of the derived class\n :class:`Pygen` instead.\n """\n\n'
7474
Mi.write(s)
7575

76-
for i in mostkeywords+moremethods:
76+
for i in mostkeywords + moremethods:
7777
p = Popen(["cas_help", i], stdout=PIPE, stderr=PIPE, universal_newlines=True)
7878
doc = p.communicate()[0]
7979

8080
doc = doc.replace("\n", "\n ") # Indent doc
81-
s = " def "+i+"(self,*args):\n"
82-
s += " r'''From Giac's documentation:\n "+doc+"\n '''\n"
83-
s += " return GiacMethods['"+i+"'](self,*args)\n\n"
81+
s = " def " + i + "(self,*args):\n"
82+
s += " r'''From Giac's documentation:\n " + doc + "\n '''\n"
83+
s += " return GiacMethods['" + i + "'](self,*args)\n\n"
8484
Mi.write(s)
8585

8686
Mi.close()

src/tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ description =
126126
# W605: invalid escape sequence ‘x’
127127
# See https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
128128
deps = pycodestyle
129-
commands = pycodestyle --select E111,E21,E227,E271,E303,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605 {posargs:{toxinidir}/sage/}
130-
pycodestyle --select E111,E306,E401,E703,W29,W391,W605,E712,E713,E714,E721,E722 --filename *.pyx {posargs:{toxinidir}/sage/}
129+
commands = pycodestyle --select E111,E21,E222,E227,E251,E271,E303,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605 {posargs:{toxinidir}/sage/}
130+
pycodestyle --select E111,E271,E306,E401,E703,E712,E713,E714,E72,W29,W391,W605, --filename *.pyx {posargs:{toxinidir}/sage/}
131131
132132
[pycodestyle]
133133
max-line-length = 160

0 commit comments

Comments
 (0)