Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docparams lint check #145

Closed
wants to merge 10 commits into from
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ limit-inference-results=100

# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
load-plugins=pylint.extensions.docparams

# Pickle collected data for later comparisons.
persistent=yes
Expand Down Expand Up @@ -69,6 +69,7 @@ disable=missing-docstring,
wrong-import-order, # Leave this up to isort
bad-continuation, # Leave this up to black
line-too-long, # Leave this up to black
Oberon00 marked this conversation as resolved.
Show resolved Hide resolved
missing-yield-type-doc, # Use return type annotation instead
exec-used

# Enable the message, report, category or checker with the given id(s). You can
Expand Down
1 change: 1 addition & 0 deletions ext/opentelemetry-ext-dbapi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
BASE_DIR, "src", "opentelemetry", "ext", "dbapi", "version.py"
)
PACKAGE_INFO = {}
# pylint:disable=exec-used
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

Expand Down
1 change: 1 addition & 0 deletions ext/opentelemetry-ext-wsgi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
BASE_DIR, "src", "opentelemetry", "ext", "wsgi", "version.py"
)
PACKAGE_INFO = {}
# pylint:disable=exec-used
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,16 @@ def _start_response(status, response_headers, *args, **kwargs):

return _start_response

# pylint: disable=missing-type-doc
def __call__(self, environ, start_response):
"""The WSGI application

Args:
environ: A WSGI environment.
start_response: The WSGI start_response callable.

Yields:
Zero or more strings that comprise the WSGI response.
"""

token = context.attach(
Expand Down
1 change: 1 addition & 0 deletions opentelemetry-api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(BASE_DIR, "src", "opentelemetry", "version.py")
PACKAGE_INFO = {}
# pylint:disable=exec-used
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

Expand Down
20 changes: 18 additions & 2 deletions opentelemetry-api/src/opentelemetry/metrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def bind(self, labels: Dict[str, str]) -> "object":

Args:
labels: Labels to associate with the bound instrument.
Returns:
A new bound metric instrument.
"""


Expand All @@ -114,6 +116,8 @@ def bind(self, labels: Dict[str, str]) -> "DefaultBoundInstrument":

Args:
labels: Labels to associate with the bound instrument.
Returns:
A new bound metric instrument.
"""
return DefaultBoundInstrument()

Expand All @@ -138,7 +142,13 @@ class Counter(Metric):
"""A counter type metric that expresses the computation of a sum."""

def bind(self, labels: Dict[str, str]) -> "BoundCounter":
"""Gets a `BoundCounter`."""
"""Gets a `BoundCounter`.

Args:
labels: Labels to associate with the bound instrument.
Returns:
A new bound metric instrument.
"""
return BoundCounter()

def add(self, value: ValueT, labels: Dict[str, str]) -> None:
Expand All @@ -157,7 +167,13 @@ class Measure(Metric):
"""

def bind(self, labels: Dict[str, str]) -> "BoundMeasure":
"""Gets a `BoundMeasure`."""
"""Gets a `BoundMeasure`.

Args:
labels: Labels to associate with the bound instrument.
Returns:
A new bound metric instrument.
"""
return BoundMeasure()

def record(self, value: ValueT, labels: Dict[str, str]) -> None:
Expand Down
2 changes: 2 additions & 0 deletions opentelemetry-api/src/opentelemetry/propagators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def extract(
which understands how to extract a value from it.
context: an optional Context to use. Defaults to current
context if not set.
Returns:
The extracted context.
"""
return get_global_httptextformat().extract(
get_from_carrier, carrier, context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _parse_tracestate(header_list: typing.List[str]) -> trace.TraceState:
"""Parse one or more w3c tracestate header into a TraceState.

Args:
string: the value of the tracestate header.
header_list: A list of tracestate headers to parse.

Returns:
A valid TraceState that contains values extracted from
Expand Down
1 change: 1 addition & 0 deletions opentelemetry-sdk/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
BASE_DIR, "src", "opentelemetry", "sdk", "version.py"
)
PACKAGE_INFO = {}
# pylint:disable=exec-used
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ class Meter(metrics_api.Meter):
Args:
instrumentation_info: The `InstrumentationInfo` for this meter.
stateful: Indicates whether the meter is stateful.
resource: The `Resource` associated with this `Meter`.
"""

def __init__(
Expand Down
9 changes: 6 additions & 3 deletions opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,12 @@ class Span(trace_api.Span):
attributes: The span's attributes to be exported
events: Timestamped events to be exported
links: Links to other spans to be exported
kind: The span kind.
span_processor: `SpanProcessor` to invoke when starting and ending
this `Span`.
instrumentation_info: Optional instrumentation info.
set_status_on_exception: Whether to populate the span's status with
error details when handling an exception.
"""

def __init__(
Expand Down Expand Up @@ -580,9 +584,8 @@ class Tracer(trace_api.Tracer):
"""See `opentelemetry.trace.Tracer`.

Args:
name: The name of the tracer.
shutdown_on_exit: Register an atexit hook to shut down the tracer when
the application exits.
source: The parent `TracerProvider`.
instrumentation_info: Information about the instrumenting library.
"""

def __init__(
Expand Down