You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
The text was updated successfully, but these errors were encountered:
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:
The text was updated successfully, but these errors were encountered: