forked from pool/python-pylama
Accepting request 999232 from home:bnavigator:branches:devel:languages:python
- Update to 8.4.1 * Support TOML configuration (thank you https://github.com/villainy) * Fix pylint integration * Fix linting for empty files - Version 8.3.8 * Better pytest integration - Version 8.3.6 * Fixed processing of linters params - Version 8.3.0 * Added support for default config file `~/.pylama.ini` - Version 8.2.0 * Added `--max-line-length` to setup max line length for pycodestyle and pylint * Support for linters options in command line - Version 8.1.4 * Support json format * Support `--from-stdin` option * Changed: pylama only allows to check python files (--force is removed) * Changed: mccabe argument `complexity` -> `max-complexity` - Version 8.0.5 * Drop support for python 2 * Support python 3.7, 3.8, 3.9 * Support mccabe==0.6.1, pycodestyle==2.8.0, pydocstyle==6.1.1, pyflakes==2.4.0, eradicate==2.0.0, radon==5.1.0, pylint==2.11.1 * Support vulture * Support 'convention' for pydocstyle * License changed to MIT (see LICENSE file for details) * Fix Radon message format OBS-URL: https://build.opensuse.org/request/show/999232 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pylama?expand=0&rev=17
This commit is contained in:
137
dummy.py
137
dummy.py
@@ -1,137 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
# (c) 2005 Divmod, Inc. See LICENSE file for details
|
||||
|
||||
|
||||
# commented code
|
||||
#import os
|
||||
# from foo import junk
|
||||
# a = 3
|
||||
a = 4
|
||||
#foo(1, 2, 3)
|
||||
|
||||
|
||||
class Message(object):
|
||||
message = ''
|
||||
message_args = ()
|
||||
def __init__(self, filename, loc, use_column=True):
|
||||
self.filename = filename
|
||||
self.lineno = loc.lineno
|
||||
self.col = getattr(loc, 'col_offset', None) if use_column else None
|
||||
test = 1
|
||||
if test == 1:
|
||||
if test == 1:
|
||||
return 28
|
||||
elif test == 2:
|
||||
return 28
|
||||
return 28
|
||||
elif test == 2:
|
||||
return 28
|
||||
|
||||
def __str__(self):
|
||||
return '%s:%s: %s' % (self.filename, self.lineno, self.message % self.message_args)
|
||||
|
||||
|
||||
class UnusedImport(Message):
|
||||
message = 'W402 %r imported but unused'
|
||||
|
||||
def __init__(self, filename, lineno, name):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name,)
|
||||
|
||||
|
||||
class RedefinedWhileUnused(Message):
|
||||
message = 'W801 redefinition of unused %r from line %r'
|
||||
|
||||
def __init__(self, filename, lineno, name, orig_lineno):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class ImportShadowedByLoopVar(Message):
|
||||
message = 'W403 import %r from line %r shadowed by loop variable'
|
||||
|
||||
def __init__(self, filename, lineno, name, orig_lineno):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class ImportStarUsed(Message):
|
||||
message = "W404 'from %s import *' used; unable to detect undefined names"
|
||||
|
||||
def __init__(self, filename, lineno, modname):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (modname,)
|
||||
|
||||
|
||||
class UndefinedName(Message):
|
||||
message = 'W802 undefined name %r'
|
||||
|
||||
def __init__(self, filename, lineno, name):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name,)
|
||||
|
||||
|
||||
class UndefinedExport(Message):
|
||||
message = 'W803 undefined name %r in __all__'
|
||||
|
||||
def __init__(self, filename, lineno, name):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name,)
|
||||
|
||||
|
||||
class UndefinedLocal(Message):
|
||||
message = "W804 local variable %r (defined in enclosing scope on line " \
|
||||
"%r) referenced before assignment"
|
||||
|
||||
def __init__(self, filename, lineno, name, orig_lineno):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class DuplicateArgument(Message):
|
||||
message = 'W805 duplicate argument %r in function definition'
|
||||
|
||||
def __init__(self, filename, lineno, name):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name,)
|
||||
|
||||
|
||||
class RedefinedFunction(Message):
|
||||
message = 'W806 redefinition of function %r from line %r'
|
||||
|
||||
def __init__(self, filename, lineno, name, orig_lineno):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class LateFutureImport(Message):
|
||||
message = 'W405 future import(s) %r after other statements'
|
||||
|
||||
def __init__(self, filename, lineno, names):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (names,)
|
||||
|
||||
|
||||
class UnusedVariable(Message):
|
||||
"""
|
||||
Indicates that a variable has been explicitly assigned to but not actually
|
||||
used.
|
||||
"""
|
||||
|
||||
message = 'W806 local variable %r is assigned to but never used'
|
||||
|
||||
def __init__(self, filename, lineno, names):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (names,)
|
||||
error = 1 # noQa and some comments
|
||||
|
||||
|
||||
class BadTyping(Message):
|
||||
"""Test the MyPy linting."""
|
||||
|
||||
message = 'error: No return value expected'
|
||||
|
||||
def bad_method(self): # type: () -> None
|
||||
"""Return type mismatch."""
|
||||
return 1
|
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9bae53ef9c1a431371d6a8dca406816a60d547147b60a4934721898f553b7d8f
|
||||
size 33278
|
3
pylama-8.4.1-gh.tar.gz
Normal file
3
pylama-8.4.1-gh.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6968f9c49ed04cff4010c2cd01a12d39c76f4f0dd0e96e381f5e9af39037bf21
|
||||
size 37850
|
@@ -1,3 +1,38 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 25 09:18:53 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Update to 8.4.1
|
||||
* Support TOML configuration (thank you
|
||||
https://github.com/villainy)
|
||||
* Fix pylint integration
|
||||
* Fix linting for empty files
|
||||
- Version 8.3.8
|
||||
* Better pytest integration
|
||||
- Version 8.3.6
|
||||
* Fixed processing of linters params
|
||||
- Version 8.3.0
|
||||
* Added support for default config file `~/.pylama.ini`
|
||||
- Version 8.2.0
|
||||
* Added `--max-line-length` to setup max line length for
|
||||
pycodestyle and pylint
|
||||
* Support for linters options in command line
|
||||
- Version 8.1.4
|
||||
* Support json format
|
||||
* Support `--from-stdin` option
|
||||
* Changed: pylama only allows to check python files (--force is
|
||||
removed)
|
||||
* Changed: mccabe argument `complexity` -> `max-complexity`
|
||||
- Version 8.0.5
|
||||
* Drop support for python 2
|
||||
* Support python 3.7, 3.8, 3.9
|
||||
* Support mccabe==0.6.1, pycodestyle==2.8.0, pydocstyle==6.1.1,
|
||||
pyflakes==2.4.0, eradicate==2.0.0, radon==5.1.0, pylint==2.11.1
|
||||
* Support vulture
|
||||
* Support 'convention' for pydocstyle
|
||||
* License changed to MIT (see LICENSE file for details)
|
||||
* Fix Radon message format
|
||||
- Drop support-pytest-6.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 10 14:33:44 UTC 2022 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
|
@@ -16,54 +16,63 @@
|
||||
#
|
||||
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
Name: python-pylama
|
||||
Version: 7.7.1
|
||||
Version: 8.4.1
|
||||
Release: 0
|
||||
Summary: Code audit tool for python
|
||||
License: LGPL-3.0-only
|
||||
License: MIT
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/klen/pylama
|
||||
Source: https://files.pythonhosted.org/packages/source/p/pylama/pylama-%{version}.tar.gz
|
||||
# https://github.com/klen/pylama/issues/147
|
||||
Source1: https://raw.githubusercontent.com/klen/pylama/develop/dummy.py
|
||||
# PATCH-FIX-UPSTREAM support-pytest-6.patch gh#klen/pylama#189
|
||||
Patch0: support-pytest-6.patch
|
||||
BuildRequires: %{python_module eradicate >= 0.2}
|
||||
BuildRequires: %{python_module mccabe >= 0.5.2}
|
||||
BuildRequires: %{python_module pycodestyle >= 2.3.1}
|
||||
BuildRequires: %{python_module pydocstyle >= 2.0.0}
|
||||
BuildRequires: %{python_module pyflakes >= 1.5.0}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module radon >= 1.4.2}
|
||||
Source: https://github.com/klen/pylama/archive/refs/tags/%{version}.tar.gz#/pylama-%{version}-gh.tar.gz
|
||||
BuildRequires: %{python_module base >= 3.7}
|
||||
BuildRequires: %{python_module mccabe >= 0.7.0}
|
||||
BuildRequires: %{python_module pycodestyle >= 2.9.1}
|
||||
BuildRequires: %{python_module pydocstyle >= 6.1.1}
|
||||
BuildRequires: %{python_module pyflakes >= 2.5.0}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: git-core
|
||||
BuildRequires: mypy
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-setuptools
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun):update-alternatives
|
||||
Recommends: mypy
|
||||
Recommends: python-mccabe >= 0.5.2
|
||||
Recommends: python-pycodestyle >= 2.3.1
|
||||
Recommends: python-pydocstyle >= 2.0.0
|
||||
Recommends: python-pyflakes >= 1.5.0
|
||||
Recommends: python-radon >= 1.4.2
|
||||
Requires: python-mccabe >= 0.7.0
|
||||
Requires: python-pycodestyle >= 2.9.1
|
||||
Requires: python-pydocstyle >= 6.1.1
|
||||
Requires: python-pyflakes >= 2.5.0
|
||||
Suggests: python-pylint
|
||||
Suggests: python-eradicate
|
||||
Suggests: python-radon
|
||||
Suggests: python-mypy
|
||||
Suggests: python-vulture
|
||||
Recommends: python-toml >= 0.10.2
|
||||
# SECTION test
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module eradicate >= 2}
|
||||
BuildRequires: %{python_module mypy}
|
||||
BuildRequires: %{python_module pylint >= 2.11.1}
|
||||
BuildRequires: %{python_module radon >= 5.1.0}
|
||||
BuildRequires: %{python_module toml >= 0.10.2}
|
||||
BuildRequires: %{python_module vulture}
|
||||
# /SECTION
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
Audit tool for Python and JavaScript. Pylama wraps these tools:
|
||||
* PEP8
|
||||
* PEP257
|
||||
* PyFlakes
|
||||
* Mccabe
|
||||
Code audit tool for Python. Pylama wraps these tools:
|
||||
|
||||
- pycodestyle (formerly pep8) © 2012-2013, Florent Xicluna;
|
||||
- pydocstyle (formerly pep257 by Vladimir Keleshev) © 2014, Amir Rachum;
|
||||
- PyFlakes © 2005-2013, Kevin Watters;
|
||||
- Mccabe © Ned Batchelder;
|
||||
- Pylint © 2013, Logilab;
|
||||
- Radon © Michele Lacchia
|
||||
- eradicate © Steven Myint;
|
||||
- Mypy © Jukka Lehtosalo and contributors;
|
||||
- Vulture © Jendrik Seipp and contributors;
|
||||
|
||||
%prep
|
||||
%setup -q -n pylama-%{version}
|
||||
cp %{SOURCE1} .
|
||||
%autopatch -p1
|
||||
%autosetup -p1 -n pylama-%{version}
|
||||
|
||||
%build
|
||||
export LANG=en_US.UTF-8
|
||||
@@ -72,17 +81,14 @@ export LANG=en_US.UTF-8
|
||||
%install
|
||||
export LANG=en_US.UTF-8
|
||||
%python_install
|
||||
%python_expand rm -rf %{buildroot}%{$python_sitelib}/tests
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%python_clone -a %{buildroot}%{_bindir}/pylama
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
export LANG=en_US.UTF-8
|
||||
# test_ignore_select - relies on number of errors reported by pyflakes/etc.
|
||||
# mypy as module is only available for default python3 provider
|
||||
%python_exec -c 'import mypy' || $python_skiptest+=" or test_mypy"
|
||||
%pytest -k "not (test_ignore_select ${$python_skiptest})"
|
||||
# pylama-quotes is on PyPI but has no active Website or repository for code maintenance
|
||||
donttest="test_quotes"
|
||||
%pytest -k "not ($donttest)"
|
||||
|
||||
%post
|
||||
%python_install_alternative pylama
|
||||
@@ -91,7 +97,7 @@ export LANG=en_US.UTF-8
|
||||
%python_uninstall_alternative pylama
|
||||
|
||||
%files %{python_files}
|
||||
%doc AUTHORS Changelog README.rst
|
||||
%doc Changelog README.rst
|
||||
%license LICENSE
|
||||
%python_alternative %{_bindir}/pylama
|
||||
%{python_sitelib}/pylama
|
||||
|
@@ -1,34 +0,0 @@
|
||||
From 84cbc4cabd88f280eecbdaa51b692812be067417 Mon Sep 17 00:00:00 2001
|
||||
From: ubaumann <github@m.ubaumann.ch>
|
||||
Date: Sun, 2 Aug 2020 18:31:04 +0200
|
||||
Subject: [PATCH] Changed to use named constructor 'from_parent'
|
||||
|
||||
Fix for pytest 6.0.0
|
||||
|
||||
https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent
|
||||
---
|
||||
pylama/pytest.py | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pylama/pytest.py b/pylama/pytest.py
|
||||
index e6f6ec1..cb89a69 100644
|
||||
--- a/pylama/pytest.py
|
||||
+++ b/pylama/pytest.py
|
||||
@@ -40,6 +40,8 @@ def pytest_sessionfinish(session):
|
||||
def pytest_collect_file(path, parent):
|
||||
config = parent.config
|
||||
if config.option.pylama and path.ext == '.py':
|
||||
+ if hasattr(PylamaItem, "from_parent"):
|
||||
+ return PylamaItem.from_parent(parent=parent, path=path, fspath=path)
|
||||
return PylamaItem(path, parent)
|
||||
|
||||
|
||||
@@ -49,7 +51,7 @@ class PylamaError(Exception):
|
||||
|
||||
class PylamaItem(pytest.Item, pytest.File):
|
||||
|
||||
- def __init__(self, path, parent):
|
||||
+ def __init__(self, path, parent, fspath=None):
|
||||
super(PylamaItem, self).__init__(path, parent)
|
||||
self.add_marker("pycodestyle")
|
||||
self.cache = None
|
Reference in New Issue
Block a user