Showing 44 of 280 total issues
CommunityComponent
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'planet-community',
templateUrl: './community.component.html',
preserveWhitespaces: true,
styleUrls: [ './community.scss' ],
SurveysComponent
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
'templateUrl': './surveys.component.html',
styles: [ `
/* Column Widths */
.mat-column-select {
CoursesAddComponent
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
templateUrl: 'courses-add.component.html',
styleUrls: [ './courses-add.scss' ]
})
export class CoursesAddComponent implements OnInit, OnDestroy {
File user.service.ts
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Injectable } from '@angular/core';
import { CouchService } from './couchdb.service';
import { catchError, switchMap, map, tap } from 'rxjs/operators';
import { of, Observable, Subject, BehaviorSubject, forkJoin } from 'rxjs';
import { findDocuments } from '../shared/mangoQueries';
Function validate_doc_update
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function (newDoc, oldDoc, userCtx, secObj) {
function require(field) {
var errMessage = field + ' is required';
if (!newDoc[field]) {
throw { forbidden: errMessage };
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function aiChatStream
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export async function aiChatStream(
messages: ChatMessage[],
aiProvider: AIProvider,
callback?: (response: string) => void
): Promise<string> {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function constructor
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
iconRegistry: MatIconRegistry,
sanitizer: DomSanitizer,
public router: Router,
private stateService: StateService
Function ngOnInit
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
ngOnInit() {
this.myPlanets.sortingDataAccessor = (item: any, property) => {
switch (property) {
case 'versionName': return (item.versionName || item.version || '').split('.').reduce((v, n) => v + n.padStart(3, '0'), '');
case 'name': return (item.customDeviceName || item.deviceName || '').toLowerCase();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function chat
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function chat(data: any, stream?: boolean, callback?: (response: string) => void): Promise<{
completionText: string;
couchSaveResponse: DocumentInsertResponse;
} | undefined> {
const { content, ...dbData } = data;
Function ngOnInit
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit() {
this.setMode();
this.onFilterChange(this.route.snapshot.paramMap.get('type') || 'exam', 'type');
if (this.mode === 'survey') {
this.onFilterChange('survey', 'type');
Function ngOnInit
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit() {
if (this.myView !== 'myPersonals') {
this.displayedColumns = [ 'select', ...this.displayedColumns, 'rating' ];
}
this.titleSearch = '';
Function validate_doc_update
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function (newDoc, oldDoc, userCtx, secObj) {
function require(field) {
var errMessage = field + ' is required';
if (!newDoc[field]) {
throw { forbidden: errMessage };
Function ngOnInit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit() {
this.titleSearch = '';
this.getCourses();
this.userShelf = this.userService.shelf;
this.courses.filterPredicate = this.filterPredicate;
Function createForm
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
createForm() {
this.resourceForm = this.fb.group({
title: [
'',
CustomValidators.required,
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
Function endDateValidator
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
static endDateValidator(): ValidatorFn {
let startDate: AbstractControl;
let endDate: AbstractControl;
// for unsubscribing from Observables
Function login
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async login({ name, password }: { name: string, password: string }, isCreate: boolean) {
const configuration = this.stateService.configuration;
const userId = `org.couchdb.user:${name}`;
try {
Function uploadImage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
uploadImage(event) {
const file = event.target.files[0];
const sanitizedFileName = file.name.trim().replace(/\s+/g, '_');
const imageExists = this.images.some(img => sanitizedFileName === img.filename);
Function openEditTransactionDialog
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
openEditTransactionDialog(transaction: any = {}) {
this.couchService.currentTime().subscribe((time: number) => {
this.dialogsFormService.openDialogsForm(
transaction._id ? $localize`Edit Transaction` : $localize`Add Transaction`,
[
Function exports
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(timeStamp) {
const user = 'e2e_' + timeStamp;
return {
get: function() {