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

Converted python code to pylint compliant. #32

Merged
merged 27 commits into from
Jun 29, 2022

Conversation

Shivani-chourasiya
Copy link
Contributor

@Shivani-chourasiya Shivani-chourasiya commented May 31, 2022

Updating the code to make it pylint compliant.

@Shivani-chourasiya Shivani-chourasiya marked this pull request as draft May 31, 2022 12:26
@Shivani-chourasiya Shivani-chourasiya force-pushed the pylint_pep8 branch 2 times, most recently from 36a51d4 to 98a485f Compare May 31, 2022 13:11
@Shivani-chourasiya Shivani-chourasiya marked this pull request as ready for review June 1, 2022 05:50
Copy link
Collaborator

@gmuloc gmuloc left a comment

Choose a reason for hiding this comment

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

Very good intiative!

This PR is mixing refactoring code functionality and linting so it is a bit hard to follow.
I cannot guarantee 100% that you are not changing some functionality. Were you able to test on a couple of examples at least?

A couple of points:

  • don't use \ to break lines except in very special occasion (cf PEP8)
  • I am wondering if simply you dont want @staticmethod rather than @classmethod everywhere. I guess you were trying to escape the infamous method could be a function pylint warning. Though in this case it makes life a bit less understandable. There is not really a reason for the checktext method to be a classmethod if the only place where we are using the class is in some debug log.
  • Sometimes pylint is having strong opinions that can decrease readability

j2lint/linter/error.py Outdated Show resolved Hide resolved
j2lint/linter/indenter/node.py Outdated Show resolved Hide resolved
j2lint/linter/rule.py Show resolved Hide resolved
j2lint/linter/rule.py Outdated Show resolved Hide resolved
j2lint/linter/rule.py Outdated Show resolved Hide resolved
j2lint/rules/jinja_template_syntax_error_rule.py Outdated Show resolved Hide resolved
j2lint/rules/jinja_variable_name_format_rule.py Outdated Show resolved Hide resolved
j2lint/settings.py Show resolved Hide resolved
j2lint/utils.py Outdated Show resolved Hide resolved
j2lint/linter/indenter/node.py Show resolved Hide resolved
Copy link
Collaborator

@gmuloc gmuloc left a comment

Choose a reason for hiding this comment

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

What is the purpose of the log in the class? It looks like it was added only to avoid to trigger unused import - more logging is good but some of these log messages do not make sense.

What do you mean with Check * rule does not exist - are you saying that the rule was not triggered for this given line? If so it maybe make sense for the method that returns True / False but for the one returning a result or a regex it is not possible to assert before the return statement if the check exist or not and so the logs seem incorrect.

Two things:

  1. It is better to log when a rule is triggered in debug rather than when it is not I would argue
  2. If the only purpose of the log message is to cater for unused-import I would not add it

j2lint/rules/jinja_statement_has_space_rule.py Outdated Show resolved Hide resolved
@Shivani-chourasiya Shivani-chourasiya force-pushed the pylint_pep8 branch 3 times, most recently from 75a4822 to 7da4e99 Compare June 6, 2022 11:10
@Shivani-chourasiya Shivani-chourasiya marked this pull request as draft June 7, 2022 04:40
@Shivani-chourasiya Shivani-chourasiya force-pushed the pylint_pep8 branch 3 times, most recently from 3f24bfb to cdd2979 Compare June 7, 2022 07:28
@Shivani-chourasiya Shivani-chourasiya marked this pull request as ready for review June 7, 2022 10:08
@Shivani-chourasiya Shivani-chourasiya force-pushed the pylint_pep8 branch 4 times, most recently from 1d62470 to a11bc34 Compare June 7, 2022 11:17
README.md Outdated Show resolved Hide resolved
j2lint/cli.py Outdated Show resolved Hide resolved
j2lint/cli.py Outdated Show resolved Hide resolved
j2lint/cli.py Outdated Show resolved Hide resolved
j2lint/linter/error.py Outdated Show resolved Hide resolved
j2lint/linter/indenter/node.py Outdated Show resolved Hide resolved
j2lint/linter/indenter/node.py Outdated Show resolved Hide resolved
j2lint/linter/indenter/node.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
gmuloc added a commit that referenced this pull request Jun 8, 2022
Note: this is introducing pylint check in the workflow - the workflow is currently failing until #32 is merged into devel
j2lint/linter/error.py Outdated Show resolved Hide resolved
j2lint/linter/error.py Outdated Show resolved Hide resolved
j2lint/cli.py Outdated Show resolved Hide resolved
j2lint/cli.py Outdated Show resolved Hide resolved
j2lint/cli.py Outdated Show resolved Hide resolved
j2lint/cli.py Outdated Show resolved Hide resolved
j2lint/cli.py Outdated Show resolved Hide resolved
j2lint/linter/indenter/node.py Show resolved Hide resolved
@Shivani-chourasiya Shivani-chourasiya marked this pull request as draft June 27, 2022 09:10
gmuloc added 2 commits June 27, 2022 15:50
* following pylint refactoring, either adjust the tests that are not
  valid anymore or remove them (2)
* in one occasion fixed some refactoring issue (returning Rule instead
  of Rule() in the load_plugins function)
* in one occasion set the correct error to be returned for a rule
* fix ordering of steps for CLI run method for stdin
this is done to follow the new filename structure for the corresponding
rules.
@Shivani-chourasiya Shivani-chourasiya marked this pull request as ready for review June 28, 2022 05:16
Copy link
Collaborator

@gmuloc gmuloc left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@carlbuchmann carlbuchmann left a comment

Choose a reason for hiding this comment

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

LGTM!

@carlbuchmann carlbuchmann merged commit bc4842d into aristanetworks:devel Jun 29, 2022
@Shivani-chourasiya Shivani-chourasiya removed their assignment Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants