%global _empty_manifest_terminate_build 0 Name: python-flake8-expression-complexity Version: 0.0.11 Release: 1 Summary: A flake8 extension that checks expressions complexity License: MIT URL: https://github.com/best-doctor/flake8-expression-complexity Source0: https://mirrors.nju.edu.cn/pypi/web/packages/19/71/5bfb69acbfd319add958c70b60e68aee8914d4a5e243b87f4fcda249cf7b/flake8_expression_complexity-0.0.11.tar.gz BuildArch: noarch Requires: python3-astpretty Requires: python3-flake8 %description # flake8-expression-complexity [![Build Status](https://github.com/best-doctor/flake8-expression-complexity/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/best-doctor/flake8-expression-complexity/actions/workflows/build.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/f85c1fd2ad4af63d93b6/maintainability)](https://codeclimate.com/github/best-doctor/flake8-expression-complexity/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/f85c1fd2ad4af63d93b6/test_coverage)](https://codeclimate.com/github/best-doctor/flake8-expression-complexity/test_coverage) [![PyPI version](https://badge.fury.io/py/flake8-expression-complexity.svg?)](https://badge.fury.io/py/flake8-expression-complexity) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flake8-expression-complexity) An extension for flake8 that validates expression complexity. Splits code into expression and scores each according to how much one is complicated. Fires an error on each expression more complex than theshold. Default complexity is 7, can be configured via `--max-expression-complexity` option. Since Django ORM queries can produce long and readable expressions, checker can skip them. To enable this behaviour, use `--ignore-django-orm-queries-complexity` option. ## Installation ```terminal pip install flake8-expression-complexity ``` ## Example ```python if ( (user and user.is_authorized) and user.subscriptions.filter(start_date__lt=today, end_date__gt=today).exists() and ( user.total_credits_added - Check.objects.filter(user=user).aggregate(Sum('price'))['check__sum'] ) and UserAction.objects.filter(user=user).last().datetime > today - datetime.timedelta(days=10) ): ... ``` Usage: ```terminal $ flake8 --max-expression-complexity=3 test.py text.py:2:5: ECE001 Expression is too complex (7.0 > 3) ``` ## Error codes | Error code | Description | |:----------:|:---------------------------------:| | ECE001 | Expression is too complex (X > Y) | ## Contributing We would love you to contribute to our project. It's simple: 1. Create an issue with bug you found or proposal you have. Wait for approve from maintainer. 1. Create a pull request. Make sure all checks are green. 1. Fix review comments if any. 1. Be awesome. Here are useful tips: - You can run all checks and tests with `make check`. Please do it before TravisCI does. - We use [BestDoctor python styleguide](https://github.com/best-doctor/guides/blob/master/guides/en/python_styleguide.md). - We respect [Django CoC](https://www.djangoproject.com/conduct/). Make soft, not bullshit. %package -n python3-flake8-expression-complexity Summary: A flake8 extension that checks expressions complexity Provides: python-flake8-expression-complexity BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-flake8-expression-complexity # flake8-expression-complexity [![Build Status](https://github.com/best-doctor/flake8-expression-complexity/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/best-doctor/flake8-expression-complexity/actions/workflows/build.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/f85c1fd2ad4af63d93b6/maintainability)](https://codeclimate.com/github/best-doctor/flake8-expression-complexity/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/f85c1fd2ad4af63d93b6/test_coverage)](https://codeclimate.com/github/best-doctor/flake8-expression-complexity/test_coverage) [![PyPI version](https://badge.fury.io/py/flake8-expression-complexity.svg?)](https://badge.fury.io/py/flake8-expression-complexity) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flake8-expression-complexity) An extension for flake8 that validates expression complexity. Splits code into expression and scores each according to how much one is complicated. Fires an error on each expression more complex than theshold. Default complexity is 7, can be configured via `--max-expression-complexity` option. Since Django ORM queries can produce long and readable expressions, checker can skip them. To enable this behaviour, use `--ignore-django-orm-queries-complexity` option. ## Installation ```terminal pip install flake8-expression-complexity ``` ## Example ```python if ( (user and user.is_authorized) and user.subscriptions.filter(start_date__lt=today, end_date__gt=today).exists() and ( user.total_credits_added - Check.objects.filter(user=user).aggregate(Sum('price'))['check__sum'] ) and UserAction.objects.filter(user=user).last().datetime > today - datetime.timedelta(days=10) ): ... ``` Usage: ```terminal $ flake8 --max-expression-complexity=3 test.py text.py:2:5: ECE001 Expression is too complex (7.0 > 3) ``` ## Error codes | Error code | Description | |:----------:|:---------------------------------:| | ECE001 | Expression is too complex (X > Y) | ## Contributing We would love you to contribute to our project. It's simple: 1. Create an issue with bug you found or proposal you have. Wait for approve from maintainer. 1. Create a pull request. Make sure all checks are green. 1. Fix review comments if any. 1. Be awesome. Here are useful tips: - You can run all checks and tests with `make check`. Please do it before TravisCI does. - We use [BestDoctor python styleguide](https://github.com/best-doctor/guides/blob/master/guides/en/python_styleguide.md). - We respect [Django CoC](https://www.djangoproject.com/conduct/). Make soft, not bullshit. %package help Summary: Development documents and examples for flake8-expression-complexity Provides: python3-flake8-expression-complexity-doc %description help # flake8-expression-complexity [![Build Status](https://github.com/best-doctor/flake8-expression-complexity/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/best-doctor/flake8-expression-complexity/actions/workflows/build.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/f85c1fd2ad4af63d93b6/maintainability)](https://codeclimate.com/github/best-doctor/flake8-expression-complexity/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/f85c1fd2ad4af63d93b6/test_coverage)](https://codeclimate.com/github/best-doctor/flake8-expression-complexity/test_coverage) [![PyPI version](https://badge.fury.io/py/flake8-expression-complexity.svg?)](https://badge.fury.io/py/flake8-expression-complexity) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flake8-expression-complexity) An extension for flake8 that validates expression complexity. Splits code into expression and scores each according to how much one is complicated. Fires an error on each expression more complex than theshold. Default complexity is 7, can be configured via `--max-expression-complexity` option. Since Django ORM queries can produce long and readable expressions, checker can skip them. To enable this behaviour, use `--ignore-django-orm-queries-complexity` option. ## Installation ```terminal pip install flake8-expression-complexity ``` ## Example ```python if ( (user and user.is_authorized) and user.subscriptions.filter(start_date__lt=today, end_date__gt=today).exists() and ( user.total_credits_added - Check.objects.filter(user=user).aggregate(Sum('price'))['check__sum'] ) and UserAction.objects.filter(user=user).last().datetime > today - datetime.timedelta(days=10) ): ... ``` Usage: ```terminal $ flake8 --max-expression-complexity=3 test.py text.py:2:5: ECE001 Expression is too complex (7.0 > 3) ``` ## Error codes | Error code | Description | |:----------:|:---------------------------------:| | ECE001 | Expression is too complex (X > Y) | ## Contributing We would love you to contribute to our project. It's simple: 1. Create an issue with bug you found or proposal you have. Wait for approve from maintainer. 1. Create a pull request. Make sure all checks are green. 1. Fix review comments if any. 1. Be awesome. Here are useful tips: - You can run all checks and tests with `make check`. Please do it before TravisCI does. - We use [BestDoctor python styleguide](https://github.com/best-doctor/guides/blob/master/guides/en/python_styleguide.md). - We respect [Django CoC](https://www.djangoproject.com/conduct/). Make soft, not bullshit. %prep %autosetup -n flake8-expression-complexity-0.0.11 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-flake8-expression-complexity -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Apr 11 2023 Python_Bot - 0.0.11-1 - Package Spec generated