Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switched from pycodestyle to pylint #174

Merged
merged 1 commit into from
Mar 16, 2019
Merged

Switched from pycodestyle to pylint #174

merged 1 commit into from
Mar 16, 2019

Conversation

LordGameleo
Copy link
Contributor

@LordGameleo LordGameleo commented Mar 10, 2019

#173
Note: It will not pass the build. We will have to correct it. I have created new issue for it. #175

@mzfr
Copy link
Contributor

mzfr commented Mar 10, 2019

I think we should have a .pylintrc too. So we can configure pylint. Because pylint have lots of options of suggestions and stuff which might not be needed.

@LordGameleo
Copy link
Contributor Author

LordGameleo commented Mar 11, 2019

What I propose is:

  • We need to discuss which all checks we need according to kodi's style of code.
  • We can have multiple issues which focuses on reformatting the codebase according to failing pylint checks one or few at a time.
  • For now I will just put all these checks in disabled state so our build passes for now and as we progress in future with these smaller issues which aims at one type of check at a time we will remove them from pylintrc file.

Benefit from doing this is:

  • As these smaller issues are resolved in future, upcoming PR will be checked for them too. (Continuous Progress)
  • It will create few first timers only/newcomers issues, creating opportunities for them.

@razzeee @Rechi @mzfr What do you think about it?

@LordGameleo
Copy link
Contributor Author

LordGameleo commented Mar 11, 2019

I disabled these checks to get a 10 on 10 score for now.

        broad-except,
        too-few-public-methods,
        parse-error,
        invalid-name,
        attribute-defined-outside-init,
        pointless-statement,
        useless-object-inheritance,
        no-else-return,
        no-name-in-module,
        len-as-condition,
        missing-docstring,
        bad-whitespace,
        duplicate-code,
        unused-import,
        unused-variable,
        useless-else-on-loop,
        bad-continuation,
        import-error,
        too-many-arguments,
        logging-not-lazy,
        undefined-variable,
        syntax-error,
        unidiomatic-typecheck,
        too-many-nested-blocks,
        inconsistent-return-statements,
        arguments-differ,
        consider-using-in,
        deprecated-method,
        redefined-outer-name,

@LordGameleo
Copy link
Contributor Author

#175
This issue will be broken into several parts for example:

  • One issue to write missing docstrings
  • One for removing unused imports and variables
  • So on

@razzeee
Copy link
Member

razzeee commented Mar 12, 2019

Sounds sensible.

My preferred setup would be to rely on the standard configuration and not configuring it at all. But getting there will take time. Am I correct that we should be able to just delete the config file then and it will just use pylint defaults?

requirements.txt Outdated Show resolved Hide resolved
@mzfr
Copy link
Contributor

mzfr commented Mar 12, 2019

@razzeee Running pylint with default config is possible and actually isn't a big task to achieve because there aren't many errors left, the most amounts of errors are about snake_case vs the camelCase so we need to decide that and then make sure everyone use that. Other than that just the docstrings and Do not use len(SEQUENCE) to determine if a sequence is empty errors are there. Which I think won't be a problem to fix.

That being said I still think that running pylint on complete default isn't a good idea(at least in my opinion) because pylint gives quite a few suggestions of itself and sometime can have False-positives.

@LordGameleo
Copy link
Contributor Author

@razzeee it is possible and I am also suggesting that. As we progress with individual issues we will remove them one by one from disabled list. And once all these issues are solved we will be left with the default configuration. Its like we will be doing it in progressive way.

Copy link
Member

@Rechi Rechi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the whole content from .pylintrc comming form? If most of it is the default configuration, I don't get the point in explicitly specifying it in this repo.
Also it seems like you have disabled more checks then actually needed. Here pylint succeeded with (only) 22 disabled checks.

.travis.yml Outdated Show resolved Hide resolved
@LordGameleo
Copy link
Contributor Author

I disabled these checks to get a 10 on 10 score for now.

        broad-except,
        too-few-public-methods,
        parse-error,
        invalid-name,
        attribute-defined-outside-init,
        pointless-statement,
        useless-object-inheritance,
        no-else-return,
        no-name-in-module,
        len-as-condition,
        missing-docstring,
        bad-whitespace,
        duplicate-code,
        unused-import,
        unused-variable,
        useless-else-on-loop,
        bad-continuation,
        import-error,
        too-many-arguments,
        logging-not-lazy,
        undefined-variable,
        syntax-error,
        unidiomatic-typecheck,
        too-many-nested-blocks,
        inconsistent-return-statements,
        arguments-differ,
        consider-using-in,
        deprecated-method,
        redefined-outer-name,

@Rechi I just disabled these checks which was causing the build to fail.... I used the feature of pylint which creates pylintrc file. Everything except what I mentioned above is default. I used standard method of pylint to create it. We can remove all other things if we want to.

@Rechi
Copy link
Member

Rechi commented Mar 13, 2019

This is now a more reasonable list, then you have in the current .pylintrc file.
The reason why parse-error, pointless-statement, syntax-error and undefined-variable have to be ignored are not actual code errors, but linting LICENSE, MANIFEST.in, PUBLISH.md, requirements.txt and script.test.
Also I don't have to exclude no-name-in-module, bad-whitespace and import-error.

@LordGameleo
Copy link
Contributor Author

@Rechi for confirming.... Do you want me to make my own customized version of pylintrc file which includes only these errors which causes the build to fail.
And yes, we are ignoring these errors just so we can merge this branch successfully without failing travis build. We will solve these errors in new issues and when they are those issues are solved we will remove those disabled errors from pylintrc( specific to these disabled ones ) and we will keep ignoring those errors which we don't have to ignore.

@LordGameleo
Copy link
Contributor Author

@razzeee @mzfr @Rechi Is there anything to change here?

Copy link
Member

@Rechi Rechi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exclude the mentioned files from the pylint check and remove the checks from the disabled list.

.pylintrc Outdated Show resolved Hide resolved
.pylintrc Outdated Show resolved Hide resolved
.pylintrc Outdated Show resolved Hide resolved
.pylintrc Outdated Show resolved Hide resolved
@LordGameleo
Copy link
Contributor Author

This is now a more reasonable list, then you have in the current .pylintrc file.
The reason why parse-error, pointless-statement, syntax-error and undefined-variable have to be ignored are not actual code errors, but linting LICENSE, MANIFEST.in, PUBLISH.md, requirements.txt and script.test.
Also I don't have to exclude no-name-in-module, bad-whitespace and import-error.

@Rechi I am sorry I guess I couldn't get what you exactly said here. I got it now, I will fix these. Sorry for making you do the extra work

@LordGameleo
Copy link
Contributor Author

@Rechi Check this once and tell me if you see anything now.

@Rechi
Copy link
Member

Rechi commented Mar 13, 2019

pip install pylint is missing in .travis.yml.

.pylintrc Outdated
attribute-defined-outside-init,
useless-object-inheritance,
no-else-return,
no-name-in-module,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not have to disable this check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a problem with pylint when using virtual env. That's why it was showing this error in my pylint check. I am removing this for now from disabled list.
pylint-dev/pylint#1524

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I don't like to disable no-name-in-module and import-error, I see the reason now in travis log.
Please readd it.

.pylintrc Outdated Show resolved Hide resolved
.pylintrc Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.pylintrc Outdated

[MESSAGES CONTROL]

disable=broad-except,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we break this up in two categories just visually.

disable=stuff-that-we-actually-want-ignored,
       stuff-that-we-actually-want-ignored2,

       stuff-thats-only-ignored-for-now-and-will-be-addressed-in-a-pr,
       stuff-thats-only-ignored-for-now-and-will-be-addressed-in-a-pr2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@razzeee I think mostly all f them are ones which we are ignoring temporarily except import-error and no-name-in-module as It will cause build to fail due to virtual environment (as mentioned in pylint-dev/pylint#1524 )

@LordGameleo
Copy link
Contributor Author

@razzeee @Rechi Please Review :)

@razzeee razzeee requested review from razzeee and Rechi March 15, 2019 10:54
.pylintrc Show resolved Hide resolved
@razzeee razzeee merged commit 7b4ea59 into xbmc:master Mar 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants