需要写11条评论行才能达到声纳中25.0%评论密度的最小阈值

问题描述 投票:-1回答:1

从下面的代码中,我得到声纳的警告,例如:11,需要编写更多注释行,才能达到25.0%注释密度的最小阈值。我真的不明白,声纳建议我要摆脱这个警告。

有人可以建议我。

代码

/**
 * 
 */
package com.att.idp.externalpartnerorder.model.accessidresource;

import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import io.swagger.annotations.ApiModelProperty;

/**
 * @author rk
 *
 */

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ValidatePinRequest implements Serializable {

    private static final long serialVersionUID = 1L;

    @JsonProperty("accountType")
    @ApiModelProperty(value = "accountType", required = false)
    private String accountType;

    private String accountNumber;

    @JsonProperty("pin")
    @ApiModelProperty(value = "pin", required = false)
    private String pin;

    @JsonProperty("guid")
    @ApiModelProperty(value = "guid", required = false)
    private String guid;


    //QAR

    @JsonProperty("email")
    @ApiModelProperty(value = "email", required = false)
    private String email;

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }



    /**
     * @return the accountType
     */
    public String getAccountType() {
        return accountType;
    }

    /**
     * @param accountType the accountType to set
     */
    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }

    /**
     * @return the accountNumber
     */
    @JsonProperty("accountNumber")
    public String getAccountNumber() {
        return accountNumber;
    }

    /**
     * @param accountNumber the accountNumber to set
     */
    @JsonProperty("accountId")
    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }




/**
 * @return the pin
 */
public String getPin() {
    return pin;
}

/**
 * @param pin the pin to set
 */
public void setPin(String pin) {
    this.pin = pin;
}

public String getGuid() {
    return guid;
}

public void setGuid(String guid) {
    this.guid = guid;
}

}

java sonarlint
1个回答
1
投票

它确切地告诉您它是什么-它需要更多评论:

https://docs.sonarqube.org/latest/user-guide/metric-definitions/#header-8

Comments (%) (comment_lines_density)
Density of comment lines = Comment lines / (Lines of code + Comment lines) * 100

With such a formula:

50% means that the number of lines of code equals the number of comment lines
100% means that the file only contains comment lines

尽管我会问谁设定那个度量标准,如果他是理智的。

© www.soinside.com 2019 - 2024. All rights reserved.