Skip to content

Commit

Permalink
Lint SDK package (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
c24t authored Jul 26, 2019
1 parent 73cadac commit f609450
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[settings]
force_single_line=True
from_first=True
from_first=True
2 changes: 2 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ confidence=
disable=missing-docstring,
fixme, # Warns about FIXME, TODO, etc. comments.
too-few-public-methods, # Might be good to re-enable this later.
too-many-instance-attributes,
too-many-arguments

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
5 changes: 4 additions & 1 deletion opentelemetry-api/src/opentelemetry/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ def my_factory_for_t(api_type: typing.Type[T]) -> typing.Optional[T]:
means that the Python interpreter was invoked with the ``-E`` or ``-I`` flag).
"""

from typing import Callable, Optional, Type, TypeVar
from typing import Callable
from typing import Optional
from typing import Type
from typing import TypeVar
import importlib
import os
import sys
Expand Down
5 changes: 4 additions & 1 deletion opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
from opentelemetry.sdk import util

try:
# pylint: disable=ungrouped-imports
from collections.abc import MutableMapping
from collections.abc import Sequence
except ImportError:
# pylint: disable=no-name-in-module,ungrouped-imports
from collections import MutableMapping
from collections import Sequence


MAX_NUM_ATTRIBUTES = 32
MAX_NUM_EVENTS = 128
MAX_NUM_LINKS = 32
Expand Down Expand Up @@ -81,6 +82,7 @@ def from_seq(cls, maxlen, seq):
if len(seq) > maxlen:
raise ValueError
bounded_list = cls(maxlen)
# pylint: disable=protected-access
bounded_list._dq = deque(seq, maxlen=maxlen)
return bounded_list

Expand Down Expand Up @@ -137,6 +139,7 @@ def from_map(cls, maxlen, mapping):
if len(mapping) > maxlen:
raise ValueError
bounded_dict = cls(maxlen)
# pylint: disable=protected-access
bounded_dict._dict = mapping
return bounded_dict

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/opentelemetry/sdk/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import time

try:
time_ns = time.time_ns # noqa
time_ns = time.time_ns # pylint: disable=invalid-name
# Python versions < 3.7
except AttributeError:
def time_ns():
Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ deps =

commands_pre =
pip install -e {toxinidir}/opentelemetry-api
pip install -e {toxinidir}/opentelemetry-sdk

commands =
; Prefer putting everything in one pylint command to profit from duplication
; warnings.
pylint opentelemetry-api/src/opentelemetry/ opentelemetry-api/tests/
flake8 opentelemetry-api/src/opentelemetry/ opentelemetry-api/tests/
isort --check-only --recursive opentelemetry-api/src
pylint opentelemetry-api/src/opentelemetry/ opentelemetry-api/tests/ opentelemetry-sdk/src/opentelemetry/ opentelemetry-sdk/tests/
flake8 opentelemetry-api/src/opentelemetry/ opentelemetry-api/tests/ opentelemetry-sdk/src/opentelemetry/ opentelemetry-sdk/tests/
isort --check-only --recursive opentelemetry-api/src opentelemetry-sdk/src

[testenv:docs]
deps =
Expand Down

0 comments on commit f609450

Please sign in to comment.