cleanText
203 return /[{([]/.test(this.lineText);
204 }
205
206 private cleanText(text: string): string {207 return text
208 .replace(/'/g, '"')
209 .replace(/\r?\n/g, "")
convert
187 return s;
188 }
189
190 convert(): string {191 if (this.statement.includes("{logger}")) {
192 return this.convertLog();
193 }
convertPrint
162 return s;
163 }
164
165 private convertPrint(): string {166 let placeholders = "";
167
168 if (this.statement === "{@}") {
convertLog
150 return placeholders;
151 }
152
153 private convertLog(): string {154 let s = this.statement.replace("{logger}", this.data.getLogger());
155
156 if (this.data.config.get("logging.useRepr")) {
getConfigPlaceholders
58 ) as string;
59 }
60
61 getConfigPlaceholders(): string { 62 return this.config.get("prints.addCustomMessage") as string;
63 }
64
It is recommended to have documentation comments above, or right inside a function/class declaration. This helps developers, users and even the author understand the purpose of a code snippet or API function in the future.
NOTE: If you want to stop this issue from getting raised on certain constructs (arrow functions, class expressions, methods etc.), consider using the skipdoccoverage option under the analyzers.meta
property in your .deepsource.toml
file.
For example, the following configuration will silence this issue for class expressions and method definitions:
[analyzers.meta]
skip_doc_coverage = ["class-expression", "method-definition"]
function sum(a, b) {
return a + b;
}
/**
* Function to add two numbers
* @param a The first number to add
* @param b The second number to add
* @returns The sum of two numbers
*/
function sum(a, b) {
return a + b;
}