Merge pull request #63 from pebenito/pylint-fix

Updates for pylint, mypy, and GitHub actions testing.
This commit is contained in:
Chris PeBenito 2021-07-28 15:00:28 -04:00 committed by GitHub
commit 2f85bd8585
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 35 additions and 49 deletions

View File

@ -17,11 +17,12 @@ jobs:
- {python: 3.6, tox: py36}
- {python: 3.7, tox: py37}
- {python: 3.8, tox: py38}
- {python: 3.9, tox: py39}
- {python: 3.6, tox: pep8}
- {python: 3.6, tox: lint}
- {python: 3.6, tox: mypy}
#- {python: 3.6, tox: coverage}
steps:
- uses: actions/checkout@v2

View File

@ -14,3 +14,6 @@ ignore_missing_imports = True
[mypy-sip]
ignore_missing_imports = True
[mypy-pkg_resources]
ignore_missing_imports = True

View File

@ -14,7 +14,7 @@ As such it contains a setup.py script that will install the tools.
To run SETools command line tools, the following packages are required:
* Python 3.6+
* NetworkX 2.0+
* NetworkX 2.0+ (2.6+ for Python 3.9+)
* setuptools
* libselinux
* libsepol 3.2+
@ -27,7 +27,7 @@ To run SETools graphical tools, the following packages are also required:
To build SETools, the following development packages are required, in
addition to the development packages from the above list:
* gcc
* cython 0.27+ (0.29.14+ for Python 3.8)
* cython 0.27+ (0.29.14+ for Python 3.8+)
To run SETools unit tests, the following packages are required, in
addition to the above dependencies:
@ -108,7 +108,7 @@ be compiled.
```
This feature assumes that the directory structure at $USERSPACE_SRC is the
same as the SELinux userspace code checked out from GitHub.
same as the SELinux userspace code checked out from GitHub.
Since SETools is dynamically linked to libsepol and libselinux, you must
specify the path to the libsepol/src and libselinux/src directories by

View File

@ -99,8 +99,7 @@ class BoundsDifference(Difference):
self._right_typebounds = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class BoundsWrapper(Wrapper[Bounds]): # pylint: disable=unsubscriptable-object
class BoundsWrapper(Wrapper[Bounds]):
"""Wrap *bounds for diff purposes."""

View File

@ -43,8 +43,7 @@ def conditional_wrapper_factory(cond: Conditional) -> "ConditionalWrapper":
return a
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class ConditionalWrapper(Wrapper[Conditional]): # pylint: disable=unsubscriptable-object
class ConditionalWrapper(Wrapper[Conditional]):
"""Wrap conditional policy expressions to allow comparisons by truth table."""

View File

@ -174,8 +174,7 @@ class ConstraintsDifference(Difference):
self._right_constraints = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class ConstraintWrapper(Wrapper[AnyConstraint]): # pylint: disable=unsubscriptable-object
class ConstraintWrapper(Wrapper[AnyConstraint]):
"""Wrap constraints for diff purposes."""

View File

@ -30,8 +30,7 @@ from .types import type_wrapper_factory
from .users import user_wrapper_factory
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class ContextWrapper(Wrapper[Context]): # pylint: disable=unsubscriptable-object
class ContextWrapper(Wrapper[Context]):
"""Wrap contexts to allow comparisons."""

View File

@ -98,8 +98,7 @@ class DefaultsDifference(Difference):
self.modified_defaults = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class DefaultWrapper(Wrapper[Default]): # pylint: disable=unsubscriptable-object
class DefaultWrapper(Wrapper[Default]):
"""Wrap default_* to allow comparisons."""

View File

@ -169,8 +169,7 @@ class Wrapper(ABC, Generic[T]):
S = TypeVar("S", bound=PolicySymbol)
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class SymbolWrapper(Wrapper[S]): # pylint: disable=unsubscriptable-object
class SymbolWrapper(Wrapper[S]):
"""
General wrapper for policy symbols, e.g. types, roles

View File

@ -74,8 +74,7 @@ class FSUsesDifference(Difference):
self.modified_fs_uses = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class FSUseWrapper(Wrapper[FSUse]): # pylint: disable=unsubscriptable-object
class FSUseWrapper(Wrapper[FSUse]):
"""Wrap fs_use_* rules to allow set operations."""

View File

@ -74,8 +74,7 @@ class GenfsconsDifference(Difference):
self.modified_genfscons = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class GenfsconWrapper(Wrapper[Genfscon]): # pylint: disable=unsubscriptable-object
class GenfsconWrapper(Wrapper[Genfscon]):
"""Wrap genfscon rules to allow set operations."""

View File

@ -73,8 +73,7 @@ class IbendportconsDifference(Difference):
self.modified_ibendportcons = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class IbendportconWrapper(Wrapper[Ibendportcon]): # pylint: disable=unsubscriptable-object
class IbendportconWrapper(Wrapper[Ibendportcon]):
"""Wrap ibendportcon statements for diff purposes."""

View File

@ -74,8 +74,7 @@ class IbpkeyconsDifference(Difference):
self.modified_ibpkeycons = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class IbpkeyconWrapper(Wrapper[Ibpkeycon]): # pylint: disable=unsubscriptable-object
class IbpkeyconWrapper(Wrapper[Ibpkeycon]):
"""Wrap ibpkeycon statements for diff purposes."""

View File

@ -218,8 +218,7 @@ class LevelDeclsDifference(Difference):
self.modified_levels = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class LevelDeclWrapper(Wrapper[LevelDecl]): # pylint: disable=unsubscriptable-object
class LevelDeclWrapper(Wrapper[LevelDecl]):
"""Wrap level declarations to allow comparisons."""
@ -242,8 +241,7 @@ class LevelDeclWrapper(Wrapper[LevelDecl]): # pylint: disable=unsubscriptable-o
return self.sensitivity < other.sensitivity
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class LevelWrapper(Wrapper[Level]): # pylint: disable=unsubscriptable-object
class LevelWrapper(Wrapper[Level]):
"""Wrap levels to allow comparisons."""
@ -276,8 +274,7 @@ class LevelWrapper(Wrapper[Level]): # pylint: disable=unsubscriptable-object
return False
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class RangeWrapper(Wrapper[Range]): # pylint: disable=unsubscriptable-object
class RangeWrapper(Wrapper[Range]):
"""
Wrap ranges to allow comparisons.

View File

@ -115,8 +115,7 @@ class MLSRulesDifference(Difference):
self._right_mls_rules = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class MLSRuleWrapper(Wrapper[MLSRule]): # pylint: disable=unsubscriptable-object
class MLSRuleWrapper(Wrapper[MLSRule]):
"""Wrap MLS rules to allow set operations."""

View File

@ -89,8 +89,7 @@ class NetifconsDifference(Difference):
self.modified_netifcons = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class NetifconWrapper(Wrapper[Netifcon]): # pylint: disable=unsubscriptable-object
class NetifconWrapper(Wrapper[Netifcon]):
"""Wrap netifcon statements for diff purposes."""

View File

@ -74,8 +74,7 @@ class NodeconsDifference(Difference):
self.modified_nodecons = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class NodeconWrapper(Wrapper[Nodecon]): # pylint: disable=unsubscriptable-object
class NodeconWrapper(Wrapper[Nodecon]):
"""Wrap nodecon statements for diff purposes."""

View File

@ -73,8 +73,7 @@ class PortconsDifference(Difference):
self.modified_portcons = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class PortconWrapper(Wrapper[Portcon]): # pylint: disable=unsubscriptable-object
class PortconWrapper(Wrapper[Portcon]):
"""Wrap portcon statements for diff purposes."""

View File

@ -137,8 +137,7 @@ class RBACRulesDifference(Difference):
self._right_rbac_rules = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class RoleAllowWrapper(Wrapper[RoleAllow]): # pylint: disable=unsubscriptable-object
class RoleAllowWrapper(Wrapper[RoleAllow]):
"""Wrap role allow rules to allow set operations."""
@ -162,8 +161,7 @@ class RoleAllowWrapper(Wrapper[RoleAllow]): # pylint: disable=unsubscriptable-o
return self.source == other.source and self.target == other.target
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class RoleTransitionWrapper(Wrapper[RoleTransition]): # pylint: disable=unsubscriptable-object
class RoleTransitionWrapper(Wrapper[RoleTransition]):
"""Wrap role_transition rules to allow set operations."""

View File

@ -550,8 +550,7 @@ class TERulesDifference(Difference):
self._right_te_rules = None
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class AVRuleXpermWrapper(Wrapper[AVRuleXperm]): # pylint: disable=unsubscriptable-object
class AVRuleXpermWrapper(Wrapper[AVRuleXperm]):
"""Wrap extended permission access vector rules to allow set operations."""
@ -581,8 +580,7 @@ class AVRuleXpermWrapper(Wrapper[AVRuleXperm]): # pylint: disable=unsubscriptab
self.xperm_type == other.xperm_type
# Pylint bug: https://github.com/PyCQA/pylint/issues/2822
class TERuleWrapper(Wrapper): # pylint: disable=unsubscriptable-object
class TERuleWrapper(Wrapper):
"""Wrap type_* rules to allow set operations."""

View File

@ -159,7 +159,7 @@ setup(name='setools',
'Topic :: Utilities',
],
keywords='SELinux SETools policy analysis tools seinfo sesearch sediff sedta seinfoflow apol',
python_requires='>=3.4',
python_requires='>=3.6',
# setup also requires libsepol and libselinux
# C libraries and headers to compile.
setup_requires=['setuptools', 'Cython>=0.27'],

View File

@ -23,7 +23,7 @@ commands = coverage run setup.py test -q
[testenv:lint]
deps = {[testenv]deps}
pylint
pylint>=2.8.0
commands_pre = pylint --version
{envpython} setup.py build_ext -i
commands = pylint -E --rcfile .pylintrc setools tests seinfo seinfoflow sedta sesearch sediff sechecker
@ -46,7 +46,10 @@ commands = mypy -p setools
[testenv]
passenv = USERSPACE_SRC
deps = networkx==2.0
deps = networkx>=2.0
cython>=0.27
py38: cython>=0.29.14
py39: networkx>=2.6
py39: cython>=0.29.14
commands_pre = {envpython} setup.py build_ext -i
commands = {envpython} setup.py test -q