Documentation comment not found for method definition
sayHi
6 constructor(){
7 super(TestController, entity)
8 }
9 static async sayHi(){10 try{
11 return entity.sayHello()
12 }
Documentation comment not found for class
TestController
2import Controller from "./controller.js";
3const entity = new TestEntity()
4
5class TestController extends Controller{ 6 constructor(){
7 super(TestController, entity)
8 }
Documentation comment not found for method definition
validate
10 super(SellerModel)
11 }
12
13 async validate(req, res){ 14
15 const seller = await this.findById(req)
16 const sellerKey = await Validator.createAuthToken({...seller, isSeller: true}, process.env.SELLER_TOKEN_KEY) //mismo caso que con el salesManager
Documentation comment not found for class
SellerController
4
5const SellerModel = new Seller();
6
7class SellerController extends Controller{ 8
9 constructor(){
10 super(SellerModel)
Documentation comment not found for method definition
validate
10 super(ManagerModel)
11 }
12
13 async validate(req, res){ 14
15 const manager = await this.findById(req)
16 const managerKey = await Validator.createAuthToken({...manager, isSeller: true}, process.env.MANAGER_TOKEN_KEY) //como no tengo el archivo env voy a inventar el nombre del token
Documentation comment not found for class
SalesManagerController
4
5const ManagerModel = new SalesManager();
6
7class SalesManagerController extends Controller{ 8
9 constructor(){
10 super(ManagerModel)
Documentation comment not found for method definition
validate
27 }
28 }
29
30 static async validate(req, res){31
32 }
33}
Documentation comment not found for method definition
deleteProduct
18 }
19 }
20
21 static async deleteProduct(req, res){22 try {
23 const product = await productModel.delete(req.params.id)
24 }
Documentation comment not found for method definition
postProducts
8 super(ProductController, productModel)
9 }
10
11 static async postProducts(req, res){12 try {
13 const {username, category, stock, price, description} = req.body
14 await productModel.create(username, category, stock, price, description)
Documentation comment not found for class
ProductController
2import Controller from './controller.js'
3const productModel = new Product()
4
5class ProductController extends Controller{ 6
7 constructor(){
8 super(ProductController, productModel)
Documentation comment not found for method definition
validate
46 }
47 }
48
49 static async validate(req, res){50
51 }
52
Documentation comment not found for method definition
deleteOrder
37 }
38 }
39
40 static async deleteOrder(req, res){41 try {
42 const order = await orderModel.delete(req.params.id)
43 }
Documentation comment not found for method definition
checkOrder
27 }
28 }
29
30 static async checkOrder(req, res){31 try {
32 const order = await orderModel.findOne(req.params.id)
33
Documentation comment not found for method definition
downloadOrder
17 }
18 }
19
20 static async downloadOrder(req, res){21 try {
22 const order = await orderModel.findOne(req.params.id)
23
Documentation comment not found for method definition
postOrders
7 super(orderController, orderModel)
8 }
9
10 static async postOrders(req, res){11 try {
12 const {date, state, totalPrice, check, paymentMethod} = req.body
13 await orderModel.create(date, state, totalPrice, check, paymentMethod)
Documentation comment not found for class
orderController
2import Controller from './controller.js'
3const orderModel = new Order()
4
5class orderController extends Controller { 6 constructor() {
7 super(orderController, orderModel)
8 }
Documentation comment not found for method definition
findError
52 }
53 }
54
55 async findError(error, res){56 return res.json({ msg: `El error es ${error.name}, cuyo mensaje es: ${error.message}` })
57 }
58}
Documentation comment not found for method definition
update
42 }
43 }
44
45 async update(req, res){46 try{
47 await this.model.update(req.params.id, req.body)
48 return res.json({ msg: `Se ha actualizado el ${Object.getPrototypeOf(this)} exitosamente` })
Documentation comment not found for method definition
findById
32 }
33 }
34
35 async findById(req, res){36 try{
37 const result = await this.model.findOne(req.params.id)
38 return res.json({ msg: `Se encontró el siguiente ${Object.getPrototypeOf(this)}`, data: result })
Documentation comment not found for method definition
find
22 // }
23 }
24
25 async find(req, res){26 try{
27 const results = await this.model.findmany()
28 return res.json({ msg: `Se encontraron los siguientes resultados`, data: results })
Documentation comment not found for method definition
create
8 this.model = model
9 }
10
11 async create(req){12
13 const entity = await this.model.create(req.body)
14 return entity
Documentation comment not found for class
Controller
1export default class Controller { 2 constructor(model) {
3 if (new.target === Controller) {
4 throw new Error('5: Cannot create an instance of Controller because it is an abstract class');
Documentation comment not found for method definition
recover
72
73 }
74
75 async recover(req, res){76
77 }
78
Documentation comment not found for method definition
validate
54 return res.json(client)
55 }
56
57 async validate(req, res){58
59 const client = await this.findById(req)
60 const clientKey = await Validator.createAuthToken({...client, isSeller: false}, process.env.CLIENT_TOKEN_KEY)
Documentation comment not found for method definition
view
49 return res.json({message : "cerraste tu cuenta"})
50 }
51
52 async view(req, res){53
54 return res.json(client)
55 }
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;
}