Documentation comment not found for method definition
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, "")
Documentation comment not found for method definition
convert
187 return s;
188 }
189
190 convert(): string {191 if (this.statement.includes("{logger}")) {
192 return this.convertLog();
193 }
Documentation comment not found for method definition
convertPrint
162 return s;
163 }
164
165 private convertPrint(): string {166 let placeholders = "";
167
168 if (this.statement === "{@}") {
Documentation comment not found for method definition
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")) {
Documentation comment not found for method definition
getConfigPlaceholders
58 ) as string;
59 }
60
61 getConfigPlaceholders(): string { 62 return this.config.get("prints.addCustomMessage") as string;
63 }
64
Documentation comment not found for method definition
getCustomMessage
51 ) as string;
52 }
53
54 getCustomMessage(): string { 55 return this.config.get(
56 "prints.customStatement",
57 config.DEFAULTS.customStatement
Documentation comment not found for method definition
getSymbol
44 ) as string;
45 }
46
47 getSymbol(): string { 48 return this.config.get(
49 "prints.customSymbol",
50 config.DEFAULTS.printSymbol
Documentation comment not found for method definition
getLogger
37 return lineNum.toString();
38 }
39
40 getLogger(): string { 41 return this.config.get(
42 "logging.customLogName",
43 config.DEFAULTS.customLogName
Documentation comment not found for method definition
getLineNum
32 return path.basename(this.editor.document.fileName);
33 }
34
35 getLineNum(): string { 36 const lineNum = this.editor.selection.start.line + 1;
37 return lineNum.toString();
38 }
Documentation comment not found for method definition
getFilename
28 return relativePath;
29 }
30
31 getFilename(): string { 32 return path.basename(this.editor.document.fileName);
33 }
34
Documentation comment not found for class
DataModel
3
4import * as config from "./config";
5
6export class DataModel { 7 public config: config.Config;
8 public editor: vscode.TextEditor;
9
Documentation comment not found for function declaration
executeCommand
6import { printConstructor } from "./print_constructor";
7import { PRINT_COMMANDS, DOCUMENT_COMMANDS } from "./statements";
8
9export async function executeCommand(10 statement: string
11): Promise<string | void> {
12 const editor = vscode.window.activeTextEditor;
Documentation comment not found for function declaration
getConfig
40 }
41}
42
43export function getConfig(): Config {44 return new Config(vscode.workspace.getConfiguration("pythonEasyPrint"));
45}
Documentation comment not found for class
Config
10 get(property: string): unknown;
11}
12
13export class Config {14 private config: IConfiguration;
15
16 constructor(configurations: IConfiguration) {
Description
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"]
Bad Practice
function sum(a, b) {
return a + b;
}
Recommended
/**
* 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;
}