Documentation Coverage Compodoc and Angular

569 Views Asked by At

As the title says I am using compodoc with Angular and it is working great so far.

My problem lies with the calculation of the code coverage. Is there a way to modify this calculation? I don't want to document the meaning of every variable if i think they are self explanatory. And I don't want a million @ignores in my code as i think it would get less readable.

Further more, i would be interested to know, if there is a way to show what i am missing. For example, compodoc says i have a low code coverage but when i look at my code, i don't know what else i could be documenting...

What am i missing?

import { Component } 

from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';

/**
 * @description snackbar component can be used to alert the user of some circumstance
 * @class SnackbarComponent
 */
@Component({
  selector: 'app-snackbar',
  templateUrl: './snackbar.component.html',
  styleUrls: ['./snackbar.component.scss']
})



export class SnackbarComponent {

  /**
   * @description default class of Snackbarcomponent
   * @memberof SnackbarComponent
   */
  timeOut = 5000;



  /**
   * Creates an instance of SnackbarComponent.
   * @param {MatSnackBar} snackBar
   * @memberof SnackbarComponent
   */
  constructor(
    public snackBar: MatSnackBar
  ) { }


  /**
   * @description takes parameters and opens a small snackbar at the bottom right of the screen
   *
   * @param {string} message text of message
   * @param {string} [className=null] color of Snackbar e.g. "red-snackbar" "green-snackbar"
   * @param {string} [action=" "] Buttontext of Snackbar
   * @return {*}  In either case, a MatSnackBarRef is returned. This can be used to dismiss the snackbar or to receive notification of when the snackbar is dismissed
   * @memberof SnackbarComponent
   * 
   * @example:
   * let snackbarRef = openSnackBar("Hello World", "Accept", "green-snackbar")
   */
  openSnackBar(message: string, className: string = null, action: string = " ") {
    return this.snackBar.open(message, action, {
      duration: this.timeOut,
      verticalPosition: 'bottom',
      horizontalPosition: 'end',
      panelClass: [className],
    });
  }
}

`

1

There are 1 best solutions below

0
On

As a tipp for everyone battling with the same issue:

I found out that compodoc does not like the @description tag. Just write your description as a normal text without an explicit tag.