Skip to content

proposal: add more linters and fix existing issues #1583

@AmanGIT07

Description

@AmanGIT07

Summary

Add the following linters to improve code quality, security, and maintainability:

  • gocognit
  • gosec
  • staticcheck
  • errcheck

Currently, gosec is only using rules G201 and G202. Existing issues from other relevant rules also need to be identified and fixed.

Why this is useful

Adding these linters will help catch issues earlier in development and reduce the chances of bugs or security problems reaching production.

gocognit

  • Detects functions with high cognitive complexity
  • Helps keep code easier to read, review, test, and maintain
  • Encourages simpler control flow and clearer logic

gosec

  • Detects insecure coding patterns
  • Helps identify issues beyond G201 and G202
  • Improves security by catching risky patterns early in CI and local development

staticcheck

  • Finds correctness, performance, and code quality issues
  • Detects ineffective assignments, broken assumptions, deprecated usage, and other subtle problems
  • Improves overall reliability of the codebase

errcheck

  • Ensures returned errors are not ignored
  • Helps prevent silent failures and inconsistent behavior
  • Encourages explicit and reliable error handling

Expected benefits

  • Catch bugs earlier in CI
  • Improve security posture
  • Make the codebase easier to maintain and refactor
  • Standardize code quality checks across the repository

Scope

  • Add the new linters to the linting pipeline
  • Expand gosec coverage beyond G201 and G202
  • Fix the issues reported by the newly enabled checks

Notes

These linters will help make the code more secure and less complex to read.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions