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

Create Tutorial - How to read, write and modify linter checks (C) #379

Open
U8NWXD opened this issue Aug 26, 2024 · 0 comments
Open

Create Tutorial - How to read, write and modify linter checks (C) #379

U8NWXD opened this issue Aug 26, 2024 · 0 comments
Labels

Comments

@U8NWXD
Copy link
Member

U8NWXD commented Aug 26, 2024

Skills covered

Using the Python AST to distinguish between hardcoded values in regular code and constant declarations.
Implementing a Pylint plugin with customizable rules and exceptions.
Considering different types of hardcoded values (numbers, strings, etc.) and defining appropriate exceptions.

Similar issues

Existing relevant pages

Example

Write a lint check to check for hardcoded values using regex or ast analysis.

The lint check should differentiate between constant declarations (typically in uppercase with underscores) and magic numbers in regular code.
The check should allow exceptions for commonly used numerical values (e.g., 0, 1, -1) and short, descriptive strings (e.g., "success", "error").
The check should be configurable, allowing developers to add or remove exceptions based on project-specific needs.

Example:

Good MAX_USERS = 100 result = "success"

Bad (would trigger a warning)

if score > 80:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

2 participants