OCA / pylint-odoo

Odoo plugin for Pylint
http://www.pylint.org
143 stars 168 forks source link

[REF] Filter out "bump version" from CHANGELOG #472

Closed antonag32 closed 1 year ago

antonag32 commented 1 year ago

Commits which bump versions will no longer be displayed on the auto generated CHANGELOG.

Closes #471.

antonag32 commented 1 year ago

Can be tested with python setup.py --long-description (at least that is how I did it).

moylop260 commented 1 year ago

Could you share the output, please?

antonag32 commented 1 year ago

Here it is:

[//]: # (start-badges)

[![Build Status](https://github.com/OCA/pylint-odoo/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/OCA/pylint-odoo/actions/workflows/test.yml?query=branch%3Amain)
[![codecov](https://codecov.io/gh/OCA/pylint-odoo/branch/main/graph/badge.svg)](https://codecov.io/gh/OCA/pylint-odoo)
[![code-style-black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![version](https://img.shields.io/pypi/v/pylint-odoo.svg)](https://pypi.org/project/pylint-odoo)
[![pypi-downloads-monthly](https://img.shields.io/pypi/dm/pylint-odoo.svg?style=flat)](https://pypi.python.org/pypi/pylint-odoo)
[![supported-versions](https://img.shields.io/pypi/pyversions/pylint-odoo.svg)](https://pypi.org/project/pylint-odoo)
[![wheel](https://img.shields.io/pypi/wheel/pylint-odoo.svg)](https://pypi.org/project/pylint-odoo)
[![commits-since](https://img.shields.io/github/commits-since/OCA/pylint-odoo/v8.0.21.svg)](https://github.com/OCA/pylint-odoo/compare/v8.0.21...main)

[//]: # (end-badges)

# Pylint Odoo plugin

Enable custom checks for Odoo modules.

[//]: # (start-checks)

Short Name | Description | Code
--- | --- | ---
attribute-deprecated | attribute "%s" deprecated | W8105
attribute-string-redundant | The attribute string is redundant. String parameter equal to name of variable | W8113
bad-builtin-groupby | Used builtin function `itertools.groupby`. Prefer `odoo.tools.groupby` instead. More info about https://github.com/odoo/odoo/issues/105376 | W8155
consider-merging-classes-inherited | Consider merging classes inherited to "%s" from %s. | R8180
context-overridden | Context overridden using dict. Better using kwargs `with_context(**%s)` or `with_context(key=value)` | W8121
deprecated-odoo-model-method | %s has been deprecated by Odoo. Please look for alternatives. | W8160
development-status-allowed | Manifest key development_status "%s" not allowed. Use one of: %s. | C8111
except-pass | pass into block except. If you really need to use the pass consider logging that exception | W8138
external-request-timeout | Use of external request method `%s` without timeout. It could wait for a long time | E8106
invalid-commit | Use of cr.commit() directly - More info https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#never-commit-the-transaction | E8102
license-allowed | License "%s" not allowed in manifest file. | C8105
manifest-author-string | The author key in the manifest file must be a string (with comma separated values) | E8101
manifest-data-duplicated | The file "%s" is duplicated in lines %s from manifest key "%s" | W8125
manifest-deprecated-key | Deprecated key "%s" in manifest file | C8103
manifest-maintainers-list | The maintainers key in the manifest file must be a list of strings | E8104
manifest-required-author | One of the following authors must be present in manifest: %s | C8101
manifest-required-key | Missing required key "%s" in manifest file | C8102
manifest-version-format | Wrong Version Format "%s" in manifest file. Regex to match: "%s" | C8106
method-compute | Name of compute method should start with "_compute_" | C8108
method-inverse | Name of inverse method should start with "_inverse_" | C8110
method-required-super | Missing `super` call in "%s" method. | W8106
method-search | Name of search method should start with "_search_" | C8109
missing-readme | Missing ./README.rst file. Template here: %s | C8112
missing-return | Missing `return` (`super` is used) in method %s. | W8110
no-raise-unlink | No exceptions should be raised inside unlink() functions | E8140
no-wizard-in-models | No wizard class for model directory. See the complete structure https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#complete-structure | C8113
no-write-in-compute | Compute method calling `write`. Use `update` instead. | E8135
odoo-addons-relative-import | Same Odoo module absolute import. You should use relative import with "." instead of "odoo.addons.%s" | W8150
odoo-exception-warning | `odoo.exceptions.Warning` is a deprecated alias to `odoo.exceptions.UserError` use `from odoo.exceptions import UserError` | R8101
print-used | Print used. Use `logger` instead. | W8116
renamed-field-parameter | Field parameter "%s" is no longer supported. Use "%s" instead. | W8111
resource-not-exist | File "%s": "%s" not found. | F8101
sql-injection | SQL injection risk. Use parameters if you can. - More info https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#no-sql-injection | E8103
test-folder-imported | Test folder imported in module %s | E8130
translation-contains-variable | Translatable term in "%s" contains variables. Use %s instead | W8115
translation-field | Translation method _("string") in fields is not necessary. | W8103
translation-format-interpolation | Use %s formatting in odoo._ functions | W8302
translation-format-truncated | Logging format string ends in middle of conversion specifier | E8301
translation-fstring-interpolation | Use %s formatting in odoo._ functions | W8303
translation-not-lazy | Use %s formatting in odoo._ functions | W8301
translation-positional-used | Translation method _(%s) is using positional string printf formatting. Use named placeholder `_("%%(placeholder)s")` instead. | W8120
translation-required | String parameter on "%s" requires translation. Use %s_(%s) | C8107
translation-too-few-args | Not enough arguments for odoo._ format string | E8306
translation-too-many-args | Too many arguments for odoo._ format string | E8305
translation-unsupported-format | Unsupported odoo._ format character %r (%#02x) at index %d | E8300
use-vim-comment | Use of vim comment | W8202
website-manifest-key-not-valid-uri | Website "%s" in manifest key is not a valid URI | W8114

[//]: # (end-checks)

# Install

You do not need to install manually if you use pre-commit-config

But if you even need to install it

    pip install pylint-odoo

# Usage pre-commit-config.yaml

Add to your ".pre-commit-config.yaml" configuration file the following input

```yaml
    - repo: https://github.com/OCA/pylint-odoo
        rev: v8.0.21 # may be a tag or commit hash
        hooks:
        # Add to your .pylintrc file:
        # [MASTER]
        # load-plugins=pylint_odoo
        - id: pylint_odoo

Usage

pylint --load-plugins=pylint_odoo -e odoolint path/to/test

or use configuration file you can generate the OCA one using the following template repository:

https://github.com/OCA/oca-addons-repo-template

Then running

pylint --rcfile=.pylintrc path/to/test

Example to test only pylint_odoo checks:

pylint --load-plugins=pylint_odoo -d all -e odoolint {ADDONS-PATH}/*

There are checks only valid for a particular Odoo version To know what version of odoo are you running pylint needs the parameter

pylint --load-plugins=pylint_odoo --valid-odoo-versions={YOUR_ODOO_VERSION}

with particular odoo version e.g. "16.0"

Checks valid only for odoo >= 14.0

translation-format-interpolation
translation-format-truncated
translation-fstring-interpolation
translation-not-lazy
translation-too-few-args
translation-too-many-args
translation-unsupported-format

Checks valid only for odoo <= 13.0

translation-contains-variable

Examples

Development

To run all the tests run:

tox

Use extra parameters to change the test behaviour

e.g. particular python version

tox -e py310

e.g. particular unittest method

tox -e py310 -- -k test_20_expected_errors

e.g. all the tests at the same time in parallel

tox -p auto

Licenses

This repository is licensed under AGPL-3.0.


OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

CHANGES

v8.0.0

7.0.4

7.0.3

7.0.2

7.0.1

7.0.0

6.2.0

6.1.0

6.0.0

5.0.5

5.0.4

5.0.3

5.0.2

5.0.1

5.0.0

4.0.0

3.10.0

3.9.0

3.8.0

3.7.1

3.7.0

3.6.0

3.5.1

3.5.0

3.4.0

3.3.2

3.3.1

3.3.0

3.2.0

3.1.0

3.0.3

3.0.2

3.0.1

3.0.0

2.0.2

2.0.1

2.0.0

1.9.5

1.9.4

1.9.3

1.8.2

1.8.1

1.8.0

1.7.0

1.6.0

1.5.0

1.4.0

1.3.5

1.3.4

1.3.3

1.3.2

1.3.1

1.3.0

1.2.0

1.1.0

1.0.2

1.0.1

1.0.0

antonag32 commented 1 year ago

nvm I see mistakes, working on them

antonag32 commented 1 year ago

Output looks better now (just an excerpt):


CHANGES
=======

* [REF] Filter out "bump version" from CHANGELOG

v8.0.21
-------

* [ADD] deprecated-odoo-model-method: New check to detect deprecated method for each Odoo version (#470)
* [REF] ci: run only one tox env per job (#468)

v8.0.20
-------

* [REF] tox: Build ChangeLog again (#466)
* [ADD] no-raise-unlink: Check if there is raise sentence in unlink method  (#458)
* [FIX] correct README pre-commit usage (#463)

v8.0.19
-------

* [FIX] pre-commit-vauxoo: Fix isort hook - RuntimeError The Poetry configuration is invalid (#456)

v8.0.18
-------

* [FIX] Readme: new CLI command format --valid-odoo-version (#453)
* [REF] ci: Update gh actions .yml and tox.ini (#451)
* [FIX] pre-commit-config: Update flake8 repo (#446)

v8.0.17
-------

* [REM] Remove unused eslintrc file
* [REF] tests: Autogenerate readme with examples from test\_repo
* [REF] tox, pre-commit, readme: Small changes (#443)

v8.0.16
-------

* [ADD] bad-builtin-groupby: Prefer \`odoo.tools.groupby\` instead (#442)

v8.0.15
-------

* [FIX] setup: Add missing "requirements.txt" file to package (#441)

v8.0.14
-------

* [REF] no-wizard-in-models: Add exception for "res.config\*" inherited classes (#439)
* [ADD] no-wizard-in-models: Add new check for avoid adding wizards class in models directory (#437)

v8.0.13
-------

* [REF] consider-merging-classes-inherited: Improve message with relpath + column number (#436)

v8.0.12
-------

* [FIX] consider-merging-classes-inherited: Fix TODO Consider case where \_inherit is assigned before to \_name (#435)
* [FIX] custom\_logging: Fix AstroidSyntaxError using only binop related to '%' (#434)

v8.0.11
-------

* [REF] manifest-data-duplicated, resource-not-exist: Improve line number (lineno) of the duplicated node (#433)

v8.0.10
-------

* [FIX] pylint\_odoo: Using node.op instead of hardcoded % (#432)

v8.0.9
------

* [FIX] pylint\_odoo: "ImportError: No module named 'packaging'" (#431)
* [REF] readme: Add monthly downloads from pypi badge (#430)
* [REF] pylint\_odoo: Using new typing astroid.nodes instead of astroid.Class (#429)

v8.0.8
------

* [ADD] no-write-in-compute: Don't write on a computed field  (#427)

v8.0.7
------

* [REF] pylint\_odoo: Replace options name from "\_" to "-" because (#426)

v8.0.6
------

* [REF] README: Auto update README (#425)
* [REF] pylint\_odoo: Process max\_odoo\_version and min\_odoo\_version for checks (#424)
* [ADD] translation-\*: Add translation-\* checks with the same "logging" checks but for "odoo.\_" translate method (#423)
* [REF] CI: Enable py3.11 (#420)

v8.0.5
------

* [REF] tox: Enable lints from environment list (#418)
* [REF] setup: Match requires-python = ">=3.7.2" from pylint (#417)
* [REF] CI: Enable tox with parallels + codecov compatibility (#415)
* [REF] augmentations: Use message code instead of message id for supression of codes (#414)

v8.0.4
------

* [REF] README: Auto-update Using pylint\_odoo.messages2md()
* [REM] class-camelcase: Replaced by invalid-name (#413)
* [REF] tests: Remove 'score' (#412)
* [REF] openerp-exception-warning: Change to odoo-exception-warning (#411)
* [REF] pylint\_odoo: Sort items for utils.only\_required\_for\_messages (#410)
* [IMP] print-used: Speed-up 'print-used' check avoid inferring (#409)
* [REM] eval-referenced: Replaced by eval-used check from pylint (#408)
* [REF] pylint\_odoo: visit\_dict - Use the dictionary key node (#407)

v8.0.3
------

* [REF] Update "visit\_\*" methods availables and order code and update values (#406)
* [ADD] missing-readme: Add again missing-readme (#405)
* [REF] pylint\_odoo: Clean code (#404)
* [REF] pylint\_odoo: Clean code (#402)

v8.0.2
------

* [REF] codecov, README: Enable codecov again and fix URLs from README (#401)

v8.0.1
------

* [REF] readme: Migrate from RST to MARKDOWN format (#400)
* [REF] pylint\_odoo: Small changes for CI, lints, pytest and code (#399)
* [REF] requirements: Update pylint dependency (#398)
* [IMP] pylint\_odoo: black, isort, prettier (#397)

v8.0.0
------

* [IMP] pylint\_odoo: apocalintSYS - Full refactoring - v8.0.0 (#396)

7.0.4
-----

* [REF] translation-positional-used: Consider srt.format('{} {}') cases (#395)

7.0.3
-----

* [REF] README: Auto-update Using pylint\_odoo.messages2rst()
* [REF] CI: Comment py3.7 travis with weird error unrelated
* [ADD] manifest-data-duplicated: Detect duplicated data file

7.0.2
-----

* [FIX] attribute-string-redundant: Only when field string is the same as title() format (#392)

7.0.1
-----

* [REF] pylint\_odoo: Update supported Odoo version 16.0 (#391)
* [REF] CI: Use py3.10 and 3.11 environments for travis (#389)
* [REF] tests: Add unittest to check only one check enabled (#385)

7.0.0
-----

* [REF] external-request-timeout: Add ftplib.FTP method (#388)
* Revert "[PERF] \*: Checkers only run when enabled #372 (#376)" (#386)
* [PERF] \*: Checkers only run when enabled #372 (#376)
* [FIX] missing-import-error: add xlrd to whitelist (#379)

6.2.0
-----

* [IMP] duplicate-po-message-definition: Detecting duplicated only with msgid (#374)
* [IMP] test-folder-imported: Consider 'from . import test' missing case (#373)

6.1.0
-----

* [REF] README: Auto-update Using pylint\_odoo.messages2rst()
* [ADD] external-request-timeout: It could wait for a long time (#370)
* [FIX] .travis.yml: npm v18.0.0 is not compatible with ubuntu used from travis (#371)
* [REF] README: Use new travis URL (#369)