Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 18 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Verify formatting

on:
push:
branches: master
pull_request:

jobs:
ruff:
runs-on: ubuntu-latest
name: Verify Python formatting
steps:
- uses: actions/checkout@v5

- uses: astral-sh/ruff-action@v3
with:
version: "0.13.1"
args: "format --check"
43 changes: 7 additions & 36 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,15 @@
---
# MegaLinter GitHub Action configuration file
# More info at https://megalinter.io
name: MegaLinter
name: Linting
on:
push:
branches: "master"
pull_request:

jobs:
megalinter:
name: MegaLinter
ruff:
runs-on: ubuntu-latest
permissions:
# Give the linter write permission to comment on PRs (if PR is not from fork)
issues: write
pull-requests: write
name: Lint Python
steps:
# Git Checkout
- name: Checkout Code
uses: actions/checkout@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
# MegaLinter
- name: MegaLinter
id: ml
# You can override MegaLinter flavor used to have faster performances
# More info at https://megalinter.io/flavors/
uses: oxsecurity/megalinter/flavors/python@v8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Validate whole codebase on pushes and only changes on pull requests
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push'}}

# Upload MegaLinter artifacts
- name: Archive production artifacts
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: MegaLinter reports
path: |
megalinter-reports
mega-linter.log
- uses: actions/checkout@v5
- uses: astral-sh/ruff-action@v3
with:
version: "0.13.1"
16 changes: 0 additions & 16 deletions .mega-linter.yml

This file was deleted.

12 changes: 4 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: mixed-line-ending
- id: end-of-file-fixer
exclude: &exclude_pattern '^changelog.d/'
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.2
rev: v0.13.1
hooks:
# Run the linter
- id: ruff
name: "Ruff: critical"
args: [
'--select=E9,F63,F7,F82',
'--output-format=full',
'--statistics'
]
name: "Ruff linting"
args: [ --fix ]
types: [file, python]
# Run the formatter
- id: ruff-format
28 changes: 4 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,33 +77,13 @@ exclude = ["tests*"]
[tool.setuptools_scm]
write_to = "src/netsnmpy/version.py"

[tool.black]
line-length = 88
# Exclude files even when passed directly as argument (for MegaLinter)
force-exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.nox
| \.tox
| \.venv
| \.ve
| _build
| buck-out
| build
| dist
)
)
'''

[tool.ruff]
line-length = 88
target-version = "py39"
# Exclude files even when passed directly as argument (for MegaLinter)
force-exclude = true

[tool.ruff.lint]
select = ["E4", "E7", "E9", "F", "I"]
fixable = ["I"]


[tool.coverage.report]
Expand Down
2 changes: 2 additions & 0 deletions src/netsnmpy/.git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Reformat files using ruff v0.13.1 @johannaengland 22/09/2025
ae84ef897aecaa6cbcf63ff19e73889193fdf4c8
2 changes: 1 addition & 1 deletion src/netsnmpy/netsnmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def __str__(self):
if enum_value:
value = f"{self.enum_value}({self.value})"
elif self.textual_convention == "DisplayString":
value = f'{self.value.decode("utf-8")!r}'
value = f"{self.value.decode('utf-8')!r}"
else:
value = self.value
return f"{self.symbolic_name} = {value}"
Expand Down
Loading