Skip to content

pylint not load rcfile in tox #7867

Closed
@fly50789

Description

@fly50789

Question

I do exactly same thing but cant get same result in Pure command and tox command.

I guess MESSAGES CONTROL is not loading to setting.

How do I check rcfile setting is loading correctly?

command
pylint --verbose --rcfile=tox.ini src

Using config file C:\Users\pega_user\Desktop\vs_project\work3\serverapi\tox.ini

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

tox -r -e linting

...
src\server_api\__init__.py:40:4: C0415: Import outside toplevel (requests) (import-outside-toplevel)
src\server_api\__init__.py:40:4: E0401: Unable to import 'requests' (import-error)
src\server_api\__init__.py:44:11: W0703: Catching too general exception Exception (broad-except)
src\server_api\__init__.py:49:17: W1202: Use lazy % formatting in logging functions (logging-format-interpolation)
...

tox.ini

[testenv:linting]
description = linting test
# cant skip install
skip_install = True
deps = pylint
commands =
           # cmd /c dir
           pylint --rcfile=tox.ini src

[MESSAGES CONTROL]
disable=C,R,W
# no use now dont know why
[pylint]

# pylint --disable=all --enable=F,E,W
#* (C) convention, for programming standard violation
#* (R) refactor, for bad code smell
#* (W) warning, for python specific problems
#* (E) error, for probable bugs in the code
#* (F) fatal, if an error occurred which prevented pylint from doing further processing.

# never-returning-functions=sys.exit
max-line-length=150
#max-module-lines=5000
#max-nested-blocks=10
#min-public-methods=1
#max-public-methods=20
#max-statements=200
#max-branches=50
#max-locals=75
#max-args=10
#notes=
#    FIXME,
#    XXX,
#    TODO

#ignore-paths=^src/server_api/__main__.py$,


disable=
    #__main__.py,
    attribute-defined-outside-init,
    invalid-name,
    missing-docstring,
    protected-access,
    too-few-public-methods,
    # handled by black
    format,
    # We anticipate #3512 where it will become optional
    fixme,
    cyclic-import,

Documentation for future user

How to check setting or Why I cant get same result between command and tox.

Additional context

No response

Activity

fly50789

fly50789 commented on Nov 29, 2022

@fly50789
Author

It is not tox problem.

I run command directly in gitlab runner but I cant load setting correctly

image

mbyrnepr2

mbyrnepr2 commented on Nov 29, 2022

@mbyrnepr2
Member

Hi @fly50789. It seems that you need to use [pylint.main] instead of [MESSAGES CONTROL] inside an ini file for this to work. Source code.

From that code block:
The use of 'MASTER' or 'master' as configuration section for pylint
has been deprecated, as it's bad practice to not start sections titles with the
tool name. Please use 'pylint.main' instead.,

I've tried a quick test with your tox command & it works for me.

removed
Needs triage 📥Just created, needs acknowledgment, triage, and proper labelling
on Nov 29, 2022
mbyrnepr2

mbyrnepr2 commented on Nov 29, 2022

@mbyrnepr2
Member

There is a section in the documentation describing the various ways of passing a configuration file; so perhaps the fix here is to add a line beneath the pyproject.toml section for tox.ini.

Would you like to contribute a MR @fly50789?

fly50789

fly50789 commented on Nov 30, 2022

@fly50789
Author

@mbyrnepr2 Sorry English is not my mother tongue, What is MR meaning?

fly50789

fly50789 commented on Nov 30, 2022

@fly50789
Author

image

It run perfectly!! Thank for your help.

I know setting file can be set in different file.

But tox is a useful tool to mange different test ,so I prefer to make all tool config in single file which is tox.ini.

fly50789

fly50789 commented on Nov 30, 2022

@fly50789
Author

Ps. is any way to overwrite setting of rcfile by command like

pylint --rcfile=tox.ini <extra-command-to-overwrite> <path>

mbyrnepr2

mbyrnepr2 commented on Nov 30, 2022

@mbyrnepr2
Member

@mbyrnepr2 Sorry English is not my mother tongue, What is MR meaning?

Sorry, I should have been clearer. I wanted to check if you are interested in creating a Merge Request to fix the documentation? Otherwise someone else can pick it up.

mbyrnepr2

mbyrnepr2 commented on Nov 30, 2022

@mbyrnepr2
Member

Ps. is any way to overwrite setting of rcfile by command like

pylint --rcfile=tox.ini <extra-command-to-overwrite> <path>

Sure, something like this:
pylint --rcfile=tox.ini --enable=missing-class-docstring,missing-module-docstring <path>

fly50789

fly50789 commented on Nov 30, 2022

@fly50789
Author

@mbyrnepr2

I have interest to do this.

But I never maintain the procedure of merge request in github.

I only use gitlab to develope my tool.

You might need to tell me more how to do.

Which part I need to write and merge to document?

Folk the project and fix document then assign to you..etc.

First I need to know how to trace the issue.

Even you refer me, I cant receive notification like below.

image

26 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pylint not load rcfile in tox · Issue #7867 · pylint-dev/pylint