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

fix: Resolved some security issues flagged by CodeQL #4

Merged
merged 7 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
| **Testing** | [![Code testing status](https://github.com/tektronix/TekHSI/actions/workflows/test-code.yml/badge.svg?branch=main)](https://github.com/tektronix/TekHSI/actions/workflows/test-code.yml) [![Docs testing status](https://github.com/tektronix/TekHSI/actions/workflows/test-docs.yml/badge.svg?branch=main)](https://github.com/tektronix/TekHSI/actions/workflows/test-docs.yml) [![Coverage status](https://codecov.io/gh/tektronix/TekHSI/branch/main/graph/badge.svg)](https://codecov.io/gh/tektronix/TekHSI) |
| **Code Quality** | [![CodeQL status](https://github.com/tektronix/TekHSI/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)](https://github.com/tektronix/TekHSI/actions/workflows/codeql-analysis.yml) [![CodeFactor grade](https://www.codefactor.io/repository/github/tektronix/TekHSI/badge)](https://www.codefactor.io/repository/github/tektronix/TekHSI) [![pre-commit status](https://results.pre-commit.ci/badge/github/tektronix/TekHSI/main.svg)](https://results.pre-commit.ci/latest/github/tektronix/TekHSI/main) |
| **Package** | [![PyPI: Package status](https://img.shields.io/pypi/status/TekHSI?logo=pypi)](https://pypi.org/project/TekHSI/) [![PyPI: Latest release version](https://img.shields.io/pypi/v/TekHSI?logo=pypi)](https://pypi.org/project/TekHSI/) [![PyPI: Supported Python versions](https://img.shields.io/pypi/pyversions/TekHSI?logo=python)](https://pypi.org/project/TekHSI/) [![PyPI: Downloads](https://pepy.tech/badge/TekHSI)](https://pepy.tech/project/TekHSI) [![License: Apache 2.0](https://img.shields.io/pypi/l/TekHSI)](https://github.com/tektronix/TekHSI/blob/main/LICENSE.md) [![Package build status](https://github.com/tektronix/TekHSI/actions/workflows/package-build.yml/badge.svg?branch=main)](https://github.com/tektronix/TekHSI/actions/workflows/package-build.yml) [![PyPI upload status](https://github.com/tektronix/TekHSI/actions/workflows/package-release.yml/badge.svg?branch=main)](https://github.com/tektronix/TekHSI/actions/workflows/package-release.yml) |
| **Documentation** | [![ReadtheDocs Status](https://img.shields.io/readthedocs/TekHSI/stable?logo=readthedocs)](https://TekHSI.readthedocs.io/stable) |
| **Documentation** | [![ReadtheDocs Status](https://img.shields.io/readthedocs/TekHSI/stable?logo=readthedocs)](https://tekhsi.readthedocs.io/stable) |
| **Code Style** | [![Test style: pytest](https://img.shields.io/badge/test%20style-pytest-blue)](https://github.com/pytest-dev/pytest) [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-black)](https://docs.astral.sh/ruff/formatter/) [![Docstring style: google](https://img.shields.io/badge/docstring%20style-google-tan)](https://google.github.io/styleguide/pyguide.html) |
| **Linting** | [![pre-commit enabled](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) [![Docstring formatter: docformatter](https://img.shields.io/badge/docstring%20formatter-docformatter-tan)](https://github.com/PyCQA/docformatter)[![Linter: pylint](https://img.shields.io/badge/linter-pylint-purple)](https://github.com/pylint-dev/pylint) |

Expand Down
2 changes: 1 addition & 1 deletion examples/simple_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

ax.set_ylim(min_val - extra, max_val + extra)
ax.set_xlim(np.min(horizontal_data), np.max(horizontal_data))
(line,) = ax.plot(horizontal_data, vertical_data)
(_,) = ax.plot(horizontal_data, vertical_data)

# Display the plot
plt.show()
4 changes: 1 addition & 3 deletions src/tekhsi/tek_hsi_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from atexit import register
from enum import Enum
from contextlib import contextmanager

from typing import List, Optional, Dict

Expand Down Expand Up @@ -214,7 +213,7 @@
################################################################################################
# Context Manager Methods
################################################################################################
@contextmanager
@contextlib.contextmanager
def access_data(self, on: AcqWaitOn = AcqWaitOn.NewData, after: float = -1):
"""Grants access to data.

Expand Down Expand Up @@ -650,7 +649,6 @@
)

sample_index = 0
data_size = header.sourcewidth
request = WaveformRequest(sourcename=header.sourcename, chunksize=self.chunksize)
response_iterator = self.native.GetWaveform(request)
dt = None
Expand Down Expand Up @@ -722,7 +720,7 @@
self._recordlength = waveform.record_length
datasize += waveform.record_length * header.sourcewidth
# TODO: reuse this variable later
_ = (

Check notice on line 723 in src/tekhsi/tek_hsi_connect.py

View check run for this annotation

codefactor.io / CodeFactor

src/tekhsi/tek_hsi_connect.py#L723

Unresolved comment '# TODO: reuse this variable later'. (C100)
waveform.record_length
* header.sourcewidth
* 8
Expand Down
2 changes: 1 addition & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import numpy as np
import pytest
from tm_data_types import AnalogWaveform, IQWaveform, DigitalWaveform, Waveform
from tm_data_types import AnalogWaveform, IQWaveform, DigitalWaveform

from tekhsi.helpers import print_with_timestamp
from tekhsi.tek_hsi_connect import TekHSIConnect, AcqWaitOn
Expand Down
Loading