Migrate to ruff, ruff-format
Drop black, flake8 and bandit. Change-Id: I74d19aaef5cab04d84d95d10d29ada4d454263d0 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
parent
ea4f13df7b
commit
b35e895a62
@ -14,17 +14,9 @@ repos:
|
||||
- id: check-yaml
|
||||
files: .*\.(yaml|yml)$
|
||||
exclude: '^zuul.d/.*$'
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: 1.7.9
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.6.4
|
||||
hooks:
|
||||
- id: bandit
|
||||
args: ['-c', 'bandit.yaml']
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 24.8.0
|
||||
hooks:
|
||||
- id: black
|
||||
args: ['-S', '-l', '79']
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 7.1.1
|
||||
hooks:
|
||||
- id: flake8
|
||||
- id: ruff
|
||||
args: ['--fix']
|
||||
- id: ruff-format
|
||||
|
@ -1,4 +0,0 @@
|
||||
skips:
|
||||
- B110
|
||||
exclude_dirs:
|
||||
- tests
|
@ -10,8 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Application base class.
|
||||
"""
|
||||
"""Application base class."""
|
||||
|
||||
import inspect
|
||||
import locale
|
||||
|
@ -10,8 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Formattable column tools.
|
||||
"""
|
||||
"""Formattable column tools."""
|
||||
|
||||
import abc
|
||||
|
||||
|
@ -10,8 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Discover and lookup command plugins.
|
||||
"""
|
||||
"""Discover and lookup command plugins."""
|
||||
|
||||
import inspect
|
||||
import logging
|
||||
|
@ -10,8 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Bash completion for the CLI.
|
||||
"""
|
||||
"""Bash completion for the CLI."""
|
||||
|
||||
import logging
|
||||
|
||||
|
@ -10,8 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Application base class for displaying data.
|
||||
"""
|
||||
"""Application base class for displaying data."""
|
||||
|
||||
import abc
|
||||
from itertools import compress
|
||||
|
||||
|
@ -10,8 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Base classes for formatters.
|
||||
"""
|
||||
"""Base classes for formatters."""
|
||||
|
||||
import abc
|
||||
|
||||
|
@ -10,8 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Output formatters using csv format.
|
||||
"""
|
||||
"""Output formatters using csv format."""
|
||||
|
||||
import csv
|
||||
import os
|
||||
|
@ -10,8 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Output formatters for JSON.
|
||||
"""
|
||||
"""Output formatters for JSON."""
|
||||
|
||||
import json
|
||||
|
||||
|
@ -10,8 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Output formatters using shell syntax.
|
||||
"""
|
||||
"""Output formatters using shell syntax."""
|
||||
|
||||
from . import base
|
||||
from cliff import columns
|
||||
|
@ -10,8 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Output formatters values only
|
||||
"""
|
||||
"""Output formatters values only"""
|
||||
|
||||
from . import base
|
||||
from cliff import columns
|
||||
|
@ -10,8 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Output formatters using PyYAML.
|
||||
"""
|
||||
"""Output formatters using PyYAML."""
|
||||
|
||||
from . import base
|
||||
from cliff import columns
|
||||
|
@ -10,8 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Application base class.
|
||||
"""
|
||||
"""Application base class."""
|
||||
|
||||
import itertools
|
||||
import shlex
|
||||
|
@ -10,8 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Application base class for displaying data about a single object.
|
||||
"""
|
||||
"""Application base class for displaying data about a single object."""
|
||||
|
||||
import abc
|
||||
|
||||
from . import display
|
||||
|
@ -267,8 +267,9 @@ class AutoprogramCliffDirective(rst.Directive):
|
||||
return manager.find_command(command_name.split())[0]
|
||||
except ValueError:
|
||||
raise self.error(
|
||||
'"{}" is not a valid command in the "{}" '
|
||||
'namespace'.format(command_name, manager.namespace)
|
||||
'"{}" is not a valid command in the "{}" ' 'namespace'.format(
|
||||
command_name, manager.namespace
|
||||
)
|
||||
)
|
||||
|
||||
def _load_commands(self):
|
||||
|
@ -64,7 +64,7 @@ def make_app(**kwargs):
|
||||
'1',
|
||||
cmd_mgr,
|
||||
stderr=mock.Mock(), # suppress warning messages
|
||||
**kwargs
|
||||
**kwargs,
|
||||
)
|
||||
return app, command
|
||||
|
||||
@ -529,7 +529,7 @@ class TestIO(base.TestBase):
|
||||
# The word "test" with the e replaced by
|
||||
# Unicode latin small letter e with acute,
|
||||
# U+00E9, utf-8 encoded as 0xC3 0xA9
|
||||
text = 't\u00E9st'
|
||||
text = 't\u00e9st'
|
||||
text_utf8 = text.encode('utf-8')
|
||||
|
||||
# In PY3 you can't write encoded bytes to a text writer
|
||||
|
@ -46,7 +46,7 @@ def make_app(**kwargs):
|
||||
'1',
|
||||
cmd_mgr,
|
||||
stderr=mock.Mock(), # suppress warning messages
|
||||
**kwargs
|
||||
**kwargs,
|
||||
)
|
||||
return app
|
||||
|
||||
|
@ -10,8 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Bash completion tests
|
||||
"""
|
||||
"""Bash completion tests"""
|
||||
|
||||
from unittest import mock
|
||||
|
||||
|
12
pyproject.toml
Normal file
12
pyproject.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[tool.ruff]
|
||||
line-length = 79
|
||||
|
||||
[tool.ruff.format]
|
||||
quote-style = "preserve"
|
||||
docstring-code-format = true
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["E4", "E7", "E9", "F", "S"]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"cliff/tests/*" = ["S"]
|
Loading…
x
Reference in New Issue
Block a user