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

Adjust Severity Levels for Lint Rules #93

Closed
notJoon opened this issue Oct 14, 2024 · 1 comment · Fixed by #95
Closed

Adjust Severity Levels for Lint Rules #93

notJoon opened this issue Oct 14, 2024 · 1 comment · Fixed by #95
Labels
C-propossal Category: sumitting RFC or proposal T-format Type: related with formatter

Comments

@notJoon
Copy link
Contributor

notJoon commented Oct 14, 2024

Description

Currently, linter rules have a uniform severity level set to SeverityError. However, this approch doesn't accurately reflect the priorities of different linting issues. So, we need to adjust severity levels to better guide developers and prioritize fixes.

Objective

Refine out the severity levels of our lint rules to more accurately reflect their impact on code quality, readability, and potential for causing runtime issues.

Proposed Changes

1. Severity Level Definitions

I propose using the following severity levels:

  • SeverityError: For issues that could lead to runtime errors, security vulnerabilities.
  • SeverityWarning: For style-related issues that don't affect functionality but impact readability or maintainability.
  • SeverityInfo: For suggestions and best practices that are good to know but not crucial. [NOT SURE]
  • SeverityOff: For rules that are disabled by default but can be enables as needed.

2. Reclassification Guidelines

Based on previous paragraph, we need to reclassify our existing lint rules based on the following criteria:

SeverityError

  • Potential runtime errors
  • Incorrect use of language features
  • Security vaulnerabilities
  • Use of deprecated function/packages

SeverityWarning

  • Code style inconsistencies (e.g., mixed identation)
  • Potential performance issues
  • Unused variables or imports (golangci-lint unused)
  • Violations of Go/Gno conventions

SeverityInfo

  • Suggestions for more idiomatic Go/Gno code.

SeverityOff

  • Project-specific or highly opinionated rules

Please comment on this issue with your thoughts, concerns, or suggestions regarding this severity level adjustment plan.


Related with #82, #91

cc: @0xtekgrinder

@notJoon notJoon added T-format Type: related with formatter C-propossal Category: sumitting RFC or proposal labels Oct 14, 2024
@0xtekgrinder
Copy link
Contributor

I agree with those suggested changes to the default severity.

However, note that in the current implementation setting to SeverityOff won't just remove all the issues, we will need to update the codebase to have this functionnality.

notJoon pushed a commit that referenced this issue Oct 17, 2024
fixes #93

This PR updates the default severity of all the rules based on the
convention.

It also refactor how default rules are added by checking if the rule is
set to SeverityOff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-propossal Category: sumitting RFC or proposal T-format Type: related with formatter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants