Passed
Pull Request — main (#155)
by Oliver
01:45
created

silence.PatchedPythonDomain.resolve_xref()   A

Complexity

Conditions 2

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 2
nop 8

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
from sphinx.domains.python import PythonDomain
2
3
4
class PatchedPythonDomain(PythonDomain):
5
    def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
6
        if 'refspecific' in node:
7
            del node['refspecific']
8
        return super(PatchedPythonDomain, self).resolve_xref(
9
            env, fromdocname, builder, typ, target, node, contnode)
10
11
12
def setup(sphinx):
13
    sphinx.add_domain(PatchedPythonDomain, override=True)
14