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

Add using-constant-test, use-list-literal & useless-object-inheritance check #100

Merged
merged 1 commit into from
Apr 14, 2023

Conversation

Ruchip16
Copy link
Member

@Ruchip16 Ruchip16 commented Apr 14, 2023

The use-list-literal check ensures using list literals (i.e., []) instead of the list() function.

The using-constant-test check indicates that if the conditional statement always evaluates to the same value and is therefore unnecessary. In this case, its better to remove the unnecessary conditional statement.

The use-a-generator check suggests to use a generator expression instead of a list comprehension inside the function. Using a generator expression instead of a list comprehension can be more efficient because it does not create a new list in memory. Instead, it generates values on the fly as they are needed, which can save memory and improve the performanceof our code.

The unused-variable check ensures that there is no unsed variable declared in the code.

The useless-object-inheritance check ensures that in Python 3, it is no longer necessary to explicitly inherit from object since all classes inherit from object by default. Therefore, we can safely remove the reference to object from the class definition. This will ensure that the class still inherits from object by default in Python 3.

Related to #85

…t-literal', 'use-a-generator' & 'unused-variable'
@Ruchip16 Ruchip16 added the bug label Apr 14, 2023
@Ruchip16 Ruchip16 self-assigned this Apr 14, 2023
@Ruchip16 Ruchip16 requested a review from a team as a code owner April 14, 2023 06:57
@Ruchip16 Ruchip16 requested review from ganeshrn, cidrblock, priyamsahoo, ssbarnea, shatakshiiii and a team and removed request for a team April 14, 2023 06:57
@ssbarnea ssbarnea merged commit 024ee84 into ansible:main Apr 14, 2023
@Ruchip16 Ruchip16 deleted the literals branch April 14, 2023 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants