Showing 200 of 200 total issues
Function onEvent
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
onEvent: function(name, event) {
// Only take actions on "htmx:afterProcessNode"
if (name !== "htmx:afterProcessNode") {
return;
Function onEvent
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
onEvent: function(name, event) {
// Only take actions on "htmx:afterProcessNode"
if (name !== "htmx:afterProcessNode") {
return;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function init
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var init = function(node) {
// If this node DOES NOT include a "GET" transaction, then there's nothing to do here.
if (node.getAttribute("href") + node.getAttribute("hx-get") + node.getAttribute("data-hx-get") == "") {
return;
Function load
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var load = function(node) {
// Called after a successful AJAX request, to mark the
// content as loaded (and prevent additional AJAX calls.)
var done = function(html) {
Function GetDiscordAccessToken
has 6 return statements (exceeds 4 allowed). Open
Open
func GetDiscordAccessToken(ctx context.Context, code string) (string, error) {
reqBody := bytes.NewBufferString(fmt.Sprintf(
"client_id=%s&client_secret=%s&grant_type=authorization_code&redirect_uri=%s&code=%s&scope=identify,email",
discordConfig.ClientID,
discordConfig.ClientSecret,
Method Instance.GetConnectedUserID
has 6 return statements (exceeds 4 allowed). Open
Open
func (instance Instance) GetConnectedUserID(ctx context.Context, tokenHeader string) (int32, error) {
if tokenHeader == "" {
return 0, errors.New("empty token")
}
Method UseCase.Login
has 5 return statements (exceeds 4 allowed). Open
Open
func (a *UseCase) Login(ctx context.Context, password string, email string) (string, error) {
userModel, err := a.IRepository.GetByEmail(ctx, email)
if err != nil {
slog.Error("user not found ", slog.Any("error", err), slog.String(" email", email))
return "", errors.New("user not found")
Method UseCase.Register
has 5 return statements (exceeds 4 allowed). Open
Open
func (a *UseCase) Register(ctx context.Context, registerStruct domain.Register) (db.User, error) {
if err := VerifyPassword(registerStruct.Password); err != nil {
return db.User{}, errors.Wrap(err, "Verify password failed")
}
exported type PageController should have comment or be unexported Open
Open
type PageController struct{}
- Exclude checks
exported type KeyManager should have comment or be unexported Open
Open
type KeyManager struct {
- Exclude checks
exported type IRepository should have comment or be unexported Open
Open
type IRepository interface {
- Exclude checks
exported function NewRedisRepository should have comment or be unexported Open
Open
func NewRedisRepository(redisConn *redis.Client) IRedisRepository {
- Exclude checks
exported function CSPMiddleware should have comment or be unexported Open
Open
func CSPMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
- Exclude checks
exported function GetCallbackURL should have comment or be unexported Open
Open
func GetCallbackURL() string {
- Exclude checks
exported function StaticAssetsCacheControlMiddleware should have comment or be unexported Open
Open
func StaticAssetsCacheControlMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
- Exclude checks
exported method PgxConnSingleton.WithConfig should have comment or be unexported Open
Open
func (p *PgxConnSingleton) WithConfig(config PgxConfig) *PgxConnSingleton {
- Exclude checks
exported method PgxConnSingleton.GetPgxConn should have comment or be unexported Open
Open
func (p *PgxConnSingleton) GetPgxConn() *pgxpool.Pool {
- Exclude checks
exported function Render should have comment or be unexported Open
Open
func Render(c echo.Context, _ int, t templ.Component) error {
- Exclude checks
exported method RedisManager.ConnectRedis should have comment or be unexported Open
Open
func (r *RedisManager) ConnectRedis() error {
- Exclude checks
exported method JwtMiddleware.AuthorizeAdmin should have comment or be unexported Open
Open
func (j *JwtMiddleware) AuthorizeAdmin(next echo.HandlerFunc) echo.HandlerFunc {
- Exclude checks