custolint


Namecustolint JSON
Version 0.4.6 PyPI version JSON
download
home_page
SummaryAnother custom linter layer
upload_time2023-08-11 09:08:03
maintainer
docs_urlNone
author
requires_python
licenseMIT License
keywords static code analysis linter python lint coverage flake8
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. COMMENT:
    script docs/conf.py will copy
    and alter this file into ./docs directory for sphinx documentations scopes

=========================
custolint - custom linter
=========================

|Custolint Logo|

Your current code-validation pipeline rules may be changed more easily using **custolint**.

|Documentation| |Python Code Coverage| |License|

.. | docs | | coverage(100%) |

**Source Code**: `<https://github.com/a-da/custolint>`_.

Custolint add new layer on top of:

- `PyLint <https://github.com/PyCQA/pylint>`_
- `Flake8 <https://github.com/PyCQA/flake8>`_
- `MyPy <https://github.com/python/mypy>`_
- `Python Coverage <https://github.com/nedbat/coveragepy>`_


Motivation
----------

You cannot just add a linter and activate 100% inspections when you have a large,
ancient codebase with thousands of lines.

|Boromir Meme|

Instead, you only make 1% of the checks available, which is really frustrating for a decent developer.

*You could enable those 100% checks just for your changes with "custolint"*.

Idea
----

.. TODO: draw a diagram.

Given we have a project alike this one, where we:

1. had added a function ``custolint/generics.py:filer_output``.
2. had modified the function ``custolint/git.py:_blame``

.. code-block:: bash
    :name: given example

    $ tree
    ...
    |-- src
    |   |-- custolint
    ...
    |   |   |-- generics.py <<<< 1
    |   |   |-- git.py      <<<< 2
    |   |   |-- mypy.py
    |   |   |-- pylint.py
    |   |   `-- typing.py
    |-- tests
    |   `-- test_custolint.py
    ...

When:

- **Detect affected files** with ``git diff`` and ``git blame``

  - ``custolint/git.py``
  - ``custolint/generics.py``

- **Run the linter** tool (pylint, flake8, mypy, coverage ...) with all available feature enables
  (the configuration have to be placed into  ``config.d/`` folder)
  only on changed affected files or parse log/result of the linter tool.

- **Match changed code** with the linters output, and consider only the match lines as failed lint criteria.
  It has to detect that ``custolint/generics.py:filer_output`` need unitest for coverage
  and ``custolint/git.py:_blame`` introduce a mypy typing issue.

Then:

- **Fail or Report** the build.

.. code-block:: bash

    $ coverage run --rcfile=config.d/.coveragerc -m pytest && \
        custolint coverage config.d/.coveragerc
    INFO:custolint.git:Execute git diff command 'git diff origin/main -U0 --diff-filter=ACMRTUXB'
    INFO:custolint.git:Git diff detected 16 filed affected
    INFO:custolint.coverage:execute coverage command: 'coverage report --data-file=.coverage --show-missing'
    src/custolint/git.py:66 not.committed.yet 2022-08-31

    $ custolint mypy
    INFO:custolint.mypy:MYPY COMPARE WITH 'main' branch
    INFO:custolint.git:Execute git diff command 'git diff origin/main -U0 --diff-filter=ACMRTUXB'
    INFO:custolint.git:Git diff detected 16 filed affected
    INFO:custolint.mypy:execute command 'mypy --config-file=config.d/mypy.ini @/tmp/f/59..000gq/T/tmp...'
    tests/test_custolint.py 31 Module has no attribute "bash"  [attr-defined] not.committed.yet 2022-08-31
    tests/test_custolint.py 125 Function is missing a return type annotation  [no-untyped-def] not.committed.yet 2022-08-31
    tests/test_custolint.py 140 Function is missing a return type annotation  [no-untyped-def] not.committed.yet 2022-08-31

Install
-------

See `Install dev version <docs/for_developers.rst>`_


How to run:
-----------

.. code-block::

    cd "${YOUR_CODE}/"

    # check typing
    custolint mypy

    # code smell checking with pylint
    custolint pylint

    # code smell checking with flake8
    custolint flake8

    # 100% coverage checking for new commits
    coverage run --rcfile=config.d/.coveragerc -m pytest
    custolint coverage config.d/.coverage


.. |Boromir Meme| image:: ./docs/_static/Boromir-meme.jpg
  :align: top
  :width: 100
  :alt: You cannot just take and (Boromir meme)

.. |Custolint Logo| image:: ./docs/_static/custolint-logo-the-future-by-RAP-studio.png
  :align: top
  :target: https://github.com/a-da/custolint
  :alt: Custolint logo

.. |Python Code Coverage| image:: https://codecov.io/github/a-da/custolint/branch/main/graph/badge.svg?token=MU42A9NAT2
  :target: https://codecov.io/github/a-da/custolint
  :alt: Python Code Coverage

.. |License| image:: https://img.shields.io/badge/License-MIT-yellow.svg
    :target: license.html
    :alt: License

.. |Documentation| image:: https://img.shields.io/readthedocs/custolint.svg
    :target: https://custolint.readthedocs.io/en/latest/
    :alt: Documentation


.. TODO: https://stackoverflow.com/a/13945797/1251677

Custolint

No Legal Copyright (c) 2022 is own by creator Danciuc Andrei.
All rights can can not reserved.

Using the MIT licence http://opensource.org/licenses/MIT

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "custolint",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "static code analysis,linter,python,lint,coverage,flake8",
    "author": "",
    "author_email": "",
    "download_url": "",
    "platform": null,
    "description": ".. COMMENT:\n    script docs/conf.py will copy\n    and alter this file into ./docs directory for sphinx documentations scopes\n\n=========================\ncustolint - custom linter\n=========================\n\n|Custolint Logo|\n\nYour current code-validation pipeline rules may be changed more easily using **custolint**.\n\n|Documentation| |Python Code Coverage| |License|\n\n.. | docs | | coverage(100%) |\n\n**Source Code**: `<https://github.com/a-da/custolint>`_.\n\nCustolint add new layer on top of:\n\n- `PyLint <https://github.com/PyCQA/pylint>`_\n- `Flake8 <https://github.com/PyCQA/flake8>`_\n- `MyPy <https://github.com/python/mypy>`_\n- `Python Coverage <https://github.com/nedbat/coveragepy>`_\n\n\nMotivation\n----------\n\nYou cannot just add a linter and activate 100% inspections when you have a large,\nancient codebase with thousands of lines.\n\n|Boromir Meme|\n\nInstead, you only make 1% of the checks available, which is really frustrating for a decent developer.\n\n*You could enable those 100% checks just for your changes with \"custolint\"*.\n\nIdea\n----\n\n.. TODO: draw a diagram.\n\nGiven we have a project alike this one, where we:\n\n1. had added a function ``custolint/generics.py:filer_output``.\n2. had modified the function ``custolint/git.py:_blame``\n\n.. code-block:: bash\n    :name: given example\n\n    $ tree\n    ...\n    |-- src\n    |   |-- custolint\n    ...\n    |   |   |-- generics.py <<<< 1\n    |   |   |-- git.py      <<<< 2\n    |   |   |-- mypy.py\n    |   |   |-- pylint.py\n    |   |   `-- typing.py\n    |-- tests\n    |   `-- test_custolint.py\n    ...\n\nWhen:\n\n- **Detect affected files** with ``git diff`` and ``git blame``\n\n  - ``custolint/git.py``\n  - ``custolint/generics.py``\n\n- **Run the linter** tool (pylint, flake8, mypy, coverage ...) with all available feature enables\n  (the configuration have to be placed into  ``config.d/`` folder)\n  only on changed affected files or parse log/result of the linter tool.\n\n- **Match changed code** with the linters output, and consider only the match lines as failed lint criteria.\n  It has to detect that ``custolint/generics.py:filer_output`` need unitest for coverage\n  and ``custolint/git.py:_blame`` introduce a mypy typing issue.\n\nThen:\n\n- **Fail or Report** the build.\n\n.. code-block:: bash\n\n    $ coverage run --rcfile=config.d/.coveragerc -m pytest && \\\n        custolint coverage config.d/.coveragerc\n    INFO:custolint.git:Execute git diff command 'git diff origin/main -U0 --diff-filter=ACMRTUXB'\n    INFO:custolint.git:Git diff detected 16 filed affected\n    INFO:custolint.coverage:execute coverage command: 'coverage report --data-file=.coverage --show-missing'\n    src/custolint/git.py:66 not.committed.yet 2022-08-31\n\n    $ custolint mypy\n    INFO:custolint.mypy:MYPY COMPARE WITH 'main' branch\n    INFO:custolint.git:Execute git diff command 'git diff origin/main -U0 --diff-filter=ACMRTUXB'\n    INFO:custolint.git:Git diff detected 16 filed affected\n    INFO:custolint.mypy:execute command 'mypy --config-file=config.d/mypy.ini @/tmp/f/59..000gq/T/tmp...'\n    tests/test_custolint.py 31 Module has no attribute \"bash\"  [attr-defined] not.committed.yet 2022-08-31\n    tests/test_custolint.py 125 Function is missing a return type annotation  [no-untyped-def] not.committed.yet 2022-08-31\n    tests/test_custolint.py 140 Function is missing a return type annotation  [no-untyped-def] not.committed.yet 2022-08-31\n\nInstall\n-------\n\nSee `Install dev version <docs/for_developers.rst>`_\n\n\nHow to run:\n-----------\n\n.. code-block::\n\n    cd \"${YOUR_CODE}/\"\n\n    # check typing\n    custolint mypy\n\n    # code smell checking with pylint\n    custolint pylint\n\n    # code smell checking with flake8\n    custolint flake8\n\n    # 100% coverage checking for new commits\n    coverage run --rcfile=config.d/.coveragerc -m pytest\n    custolint coverage config.d/.coverage\n\n\n.. |Boromir Meme| image:: ./docs/_static/Boromir-meme.jpg\n  :align: top\n  :width: 100\n  :alt: You cannot just take and (Boromir meme)\n\n.. |Custolint Logo| image:: ./docs/_static/custolint-logo-the-future-by-RAP-studio.png\n  :align: top\n  :target: https://github.com/a-da/custolint\n  :alt: Custolint logo\n\n.. |Python Code Coverage| image:: https://codecov.io/github/a-da/custolint/branch/main/graph/badge.svg?token=MU42A9NAT2\n  :target: https://codecov.io/github/a-da/custolint\n  :alt: Python Code Coverage\n\n.. |License| image:: https://img.shields.io/badge/License-MIT-yellow.svg\n    :target: license.html\n    :alt: License\n\n.. |Documentation| image:: https://img.shields.io/readthedocs/custolint.svg\n    :target: https://custolint.readthedocs.io/en/latest/\n    :alt: Documentation\n\n\n.. TODO: https://stackoverflow.com/a/13945797/1251677\n\nCustolint\n\nNo Legal Copyright (c) 2022 is own by creator Danciuc Andrei.\nAll rights can can not reserved.\n\nUsing the MIT licence http://opensource.org/licenses/MIT\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Another custom linter layer",
    "version": "0.4.6",
    "project_urls": null,
    "split_keywords": [
        "static code analysis",
        "linter",
        "python",
        "lint",
        "coverage",
        "flake8"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7a2e79485c6795dae3b561418c4ce00ff3357b7b5faaca9f0a9831f79b172c4b",
                "md5": "3d35dc41802625461fc5a7d8caed2b7f",
                "sha256": "5117a6fba6c1ad2108a6be51900d8d49d52379d8010d311cc70ee9354b2e2007"
            },
            "downloads": -1,
            "filename": "custolint-0.4.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3d35dc41802625461fc5a7d8caed2b7f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 24016,
            "upload_time": "2023-08-11T09:08:03",
            "upload_time_iso_8601": "2023-08-11T09:08:03.387551Z",
            "url": "https://files.pythonhosted.org/packages/7a/2e/79485c6795dae3b561418c4ce00ff3357b7b5faaca9f0a9831f79b172c4b/custolint-0.4.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-11 09:08:03",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "custolint"
}
        
Elapsed time: 0.10497s