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

Static checks: introduce usage of "avocado-static-checks" project #4059

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Check signed-off-by
run: ./selftests/signedoff-check.sh
- name: Install make
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "avocado-static-checks"]
path = avocado-static-checks
url = https://github.com/avocado-framework/avocado-static-checks
2 changes: 1 addition & 1 deletion CODING_STYLE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Base coding style

The coding style for all Python code is the one enforced by black (see
https://black.readthedocs.io/en/stable/the_black_code_style/). The
selftests/style.sh script can be used to verify the code style matches.
avocado-static-checks/check-style script can be used to verify the code style matches.


Variable names and UpPeR cAsE
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ requirements: pip
- $(PYTHON) -m pip install -r requirements.txt

check:
./selftests/style.sh
./selftests/isort.sh
./avocado-static-checks/check-style
./avocado-static-checks/check-import-order
inspekt lint --disable W,R,C,E0203,E0601,E1002,E1101,E1102,E1103,E1120,F0401,I0011,E1003,W605,I1101 --exclude avocado-libs,scripts/github
pylint --errors-only --disable=all --enable=spelling --spelling-dict=en_US --spelling-private-dict-file=spell.ignore *

Expand Down
1 change: 1 addition & 0 deletions avocado-static-checks
Submodule avocado-static-checks added at 8a2c5d
2 changes: 0 additions & 2 deletions avocado_vt/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def arch_listing(config, guest_name_parser=None):


class NotAvocadoVTTest(object):

"""
Not an Avocado-vt test (for reporting purposes)
"""
Expand All @@ -93,7 +92,6 @@ class NotAvocadoVTTest(object):
if AVOCADO_LOADER_AVAILABLE:

class VirtTestLoader(loader.TestLoader, DiscoveryMixIn):

"""
Avocado loader plugin to load avocado-vt tests
"""
Expand Down
1 change: 0 additions & 1 deletion avocado_vt/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@


class VirtTestOptionsProcess(object):

"""
Pick virt test options and parse them to get to a cartesian parser.
"""
Expand Down
1 change: 0 additions & 1 deletion avocado_vt/plugins/vt.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ def _str_or_none(arg):


class VTRun(CLI):

"""
Avocado VT - legacy virt-test support
"""
Expand Down
1 change: 0 additions & 1 deletion avocado_vt/plugins/vt_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@


class VTBootstrap(CLICmd):

"""
Avocado VT - implements the 'vt-bootstrap' subcommand
"""
Expand Down
2 changes: 0 additions & 2 deletions avocado_vt/plugins/vt_joblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


class LockCreationError(Exception):

"""
Represents any error situation when attempting to create a lock file
"""
Expand All @@ -28,7 +27,6 @@ class LockCreationError(Exception):


class OtherProcessHoldsLockError(Exception):

"""
Represents a condition where other process has the lock
"""
Expand Down
1 change: 0 additions & 1 deletion avocado_vt/plugins/vt_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@


class VTLister(CLI):

"""
Avocado VT - implements legacy virt-test listing
"""
Expand Down
1 change: 0 additions & 1 deletion avocado_vt/plugins/vt_list_archs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class VTListArchs(CLICmd):

"""
Avocado VT - implements vt-list-archs command
"""
Expand Down
1 change: 0 additions & 1 deletion avocado_vt/plugins/vt_list_guests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class VTListGuests(CLICmd):

"""
Avocado VT - implements vt-list-guests command
"""
Expand Down
1 change: 0 additions & 1 deletion avocado_vt/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def cleanup_env(env_filename, env_version):


class VirtTest(test.Test, utils.TestUtils):

"""
Minimal test class used to run a virt test.
"""
Expand Down
2 changes: 1 addition & 1 deletion docs/source/contributing/DownloadSource.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The main source is maintained on git and may be cloned as below:

::

git clone https://github.com/avocado-framework/avocado-vt.git
git clone --recurse-submodules https://github.com/avocado-framework/avocado-vt.git

If you want to learn how to use git as an effective contribution tool, consider
reading `the git workflow autotest docs <https://github.com/autotest/autotest/wiki/GitWorkflow>`_
Expand Down
2 changes: 1 addition & 1 deletion docs/source/contributing/Guidelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Rules for Maintainers
Rules for Contributors
======================

1. [Must] Coding style should conform to what's enforced by black (see ``selftests/style.sh``)
1. [Must] Coding style should conform to what's enforced by black (see ``./avocado-static-checks/check-style``)
2. [Must] PR commit message is meaningful. Refer to the link on how to write a good commit message
3. [Must] Travis CI pass and no conflict
4. [Must] Provide test results. If no, provide justification. Apply to any PR
Expand Down
1 change: 1 addition & 0 deletions examples/tests/bad_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
:difficulty: simple
:copyright: 2014 Red Hat Inc.
"""

from avocado.utils import process


Expand Down
1 change: 1 addition & 0 deletions examples/tests/guest_hostname.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
:difficulty: simple
:copyright: 2014 Red Hat Inc.
"""

import logging

LOG = logging.getLogger("avocado.vt.examples.guest_hostname")
Expand Down
1 change: 1 addition & 0 deletions examples/tests/hostname.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:difficulty: simple
:copyright: 2014 Red Hat Inc.
"""

import logging

from avocado.utils import process
Expand Down
1 change: 1 addition & 0 deletions examples/tests/ls_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
:difficulty: advanced
:copyright: 2014 Red Hat Inc.
"""

import logging

LOG = logging.getLogger("avocado.vt.examples.lsdisk")
Expand Down
1 change: 1 addition & 0 deletions examples/tests/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:difficulty: advanced
:copyright: 2014 Red Hat Inc.
"""

import logging
import time

Expand Down
2 changes: 1 addition & 1 deletion requirements-travis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ inspektor==0.5.3
aexpect>=1.6.4
netifaces==0.11.0
pyenchant==3.2.2
black==22.3.0
black==24.3.0
isort==5.10.1
4 changes: 0 additions & 4 deletions scripts/github/github_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def __init__(self, *stuff):


class GithubCache(object):

"""
Auto-refreshing github.GithubObject.GithubObject from dict
"""
Expand Down Expand Up @@ -193,7 +192,6 @@ def cached_data(self):


class GithubIssuesBase(list):

"""
Base class for cached list of github issues
"""
Expand Down Expand Up @@ -318,7 +316,6 @@ def values(self):


class GithubIssues(GithubIssuesBase, object):

"""
Read-only List-like interface to cached github issues in standardized format
"""
Expand Down Expand Up @@ -696,7 +693,6 @@ def __init__(self, key, number):


class MutableIssue(dict):

"""Allow modification of some issue values"""

def __init__(self, github_issues, issue_number):
Expand Down
2 changes: 0 additions & 2 deletions scripts/koji_pkgspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class OptionParser(optparse.OptionParser):

"""
KojiPkgSpec App option parser
"""
Expand Down Expand Up @@ -58,7 +57,6 @@ def __init__(self):


class App(object):

"""
KojiPkgSpec app
"""
Expand Down
1 change: 0 additions & 1 deletion scripts/logging_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class AllowBelowSeverity(logging.Filter):

"""
Allows only records less severe than a given level (the opposite of what
the normal logging level filtering does.
Expand Down
1 change: 0 additions & 1 deletion scripts/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def get_test_keyval(jobid, keyname, default=""):


class Sample(object):

"""Collect test results in same environment to a sample"""

def __init__(self, sample_type, arg):
Expand Down
2 changes: 0 additions & 2 deletions scripts/virt_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


class OptionParser(optparse.OptionParser):

"""
App option parser
"""
Expand Down Expand Up @@ -82,7 +81,6 @@ def __init__(self):


class App:

"""
Virt Disk Creation App
"""
Expand Down
3 changes: 2 additions & 1 deletion selftests/doc/test_doc_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

This is geared towards documentation build regression testing.
"""

import os
import unittest

Expand Down Expand Up @@ -52,7 +53,7 @@ def test_build_docs(self):
"%s ERRORS and/or WARNINGS detected while building the html docs:\n"
% len(failure_lines)
)
for (index, failure_line) in enumerate(failure_lines):
for index, failure_line in enumerate(failure_lines):
e_msg += "%s) %s\n" % (index + 1, failure_line)
e_msg += "Full output: %s\n" % "\n".join(output_lines)
e_msg += "Please check the output and fix your docstrings/.rst docs"
Expand Down
3 changes: 0 additions & 3 deletions selftests/isort.sh

This file was deleted.

4 changes: 0 additions & 4 deletions selftests/style.sh

This file was deleted.

2 changes: 0 additions & 2 deletions selftests/unit/test_libvirt_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@


class NetworkTestBase(unittest.TestCase):

"""
Base class for NetworkXML test providing fake virsh commands.
"""
Expand Down Expand Up @@ -111,7 +110,6 @@ def setUp(self):


class NetworkXMLTest(NetworkTestBase):

"""
Unit test class for manipulator methods in NetworkXML class.
"""
Expand Down
7 changes: 1 addition & 6 deletions selftests/unit/test_qemu_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@


class ParamsDict(dict):

"""params like dictionary"""

def objects(self, item):
Expand All @@ -51,14 +50,13 @@ def objects(self, item):

def object_params(self, obj):
ret = self.copy()
for (param, value) in six.iteritems(self):
for param, value in six.iteritems(self):
if param.endswith("_%s" % obj):
ret[param[: -len("_%s" % obj)]] = value
return ret


class MockHMPMonitor(qemu_monitor.HumanMonitor):

"""Dummy class inherited from qemu_monitor.HumanMonitor"""

def __init__(self): # pylint: disable=W0231
Expand All @@ -69,7 +67,6 @@ def __del__(self):


class Devices(unittest.TestCase):

"""set of qemu devices tests"""

def test_q_base_device(self):
Expand Down Expand Up @@ -151,7 +148,6 @@ def test_q_device(self):


class Buses(unittest.TestCase):

"""Set of bus-representation tests"""

def test_q_sparse_bus(self):
Expand Down Expand Up @@ -671,7 +667,6 @@ def test_usb_bus(self):


class Container(unittest.TestCase):

"""Tests related to the abstract representation of qemu machine"""

def setUp(self):
Expand Down
1 change: 0 additions & 1 deletion selftests/unit/test_qemu_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class MockMonitor(qemu_monitor.Monitor):

"""Dummy class inherited from qemu_monitor.HumanMonitor"""

def __init__(self): # pylint: disable=W0231
Expand Down
Loading