devopslibrary/adde

View on GitHub

Showing 53 of 53 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it('should return generated schema if possible', async () => {
const schema = service.getSchema('./test/fixtures/fakeData');
expect(schema).toEqual({
$id: 'fakeData',
$schema: 'http://json-schema.org/draft-07/schema#',
Severity: Major
Found in backend/src/schema/schema.service.spec.ts and 1 other location - About 7 hrs to fix
backend/src/schema/schema.service.spec.ts on lines 124..159

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it('should return generated schema when it scans a folder with multiple JSON files', async () => {
const schema = service.generateSchema('./test/fixtures/fakeData');
expect(schema).toEqual({
$id: 'fakeData',
$schema: 'http://json-schema.org/draft-07/schema#',
Severity: Major
Found in backend/src/schema/schema.service.spec.ts and 1 other location - About 7 hrs to fix
backend/src/schema/schema.service.spec.ts on lines 66..101

Similar blocks of code found in 3 locations. Consider refactoring.
Open

expect(data).toEqual([
{
name: 'Indianapolis Production Datacenter 01',
lastUpdated: '2020-12-30T19:31:99Z',
shortname: 'ind01pr',
Severity: Major
Found in backend/src/restAPI/restAPI.service.spec.ts and 2 other locations - About 6 hrs to fix
backend/src/restAPI/restAPI.controller.spec.ts on lines 33..58
backend/src/restAPI/restAPI.service.spec.ts on lines 221..246

Similar blocks of code found in 3 locations. Consider refactoring.
Open

expect(list).toEqual([
{
name: 'Indianapolis Production Datacenter 01',
lastUpdated: '2020-12-30T19:31:99Z',
shortname: 'ind01pr',
Severity: Major
Found in backend/src/restAPI/restAPI.service.spec.ts and 2 other locations - About 6 hrs to fix
backend/src/restAPI/restAPI.controller.spec.ts on lines 33..58
backend/src/restAPI/restAPI.service.spec.ts on lines 49..74

Similar blocks of code found in 3 locations. Consider refactoring.
Open

expect(webhookOutput).toMatchObject([
{
name: 'Indianapolis Production Datacenter 01',
lastUpdated: '2020-12-30T19:31:99Z',
shortname: 'ind01pr',
Severity: Major
Found in backend/src/restAPI/restAPI.controller.spec.ts and 2 other locations - About 6 hrs to fix
backend/src/restAPI/restAPI.service.spec.ts on lines 49..74
backend/src/restAPI/restAPI.service.spec.ts on lines 221..246

Similar blocks of code found in 3 locations. Consider refactoring.
Open

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [
SwaggerModule,
ConfigModule.forRoot({
Severity: Major
Found in backend/src/swagger/swagger.service.spec.ts and 2 other locations - About 3 hrs to fix
backend/src/restAPI/restAPI.controller.spec.ts on lines 10..22
backend/src/swagger/swagger.controller.spec.ts on lines 9..21

Similar blocks of code found in 3 locations. Consider refactoring.
Open

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [
RestApiModule,
ConfigModule.forRoot({
Severity: Major
Found in backend/src/restAPI/restAPI.controller.spec.ts and 2 other locations - About 3 hrs to fix
backend/src/swagger/swagger.controller.spec.ts on lines 9..21
backend/src/swagger/swagger.service.spec.ts on lines 10..22

Similar blocks of code found in 3 locations. Consider refactoring.
Open

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [
SwaggerModule,
ConfigModule.forRoot({
Severity: Major
Found in backend/src/swagger/swagger.controller.spec.ts and 2 other locations - About 3 hrs to fix
backend/src/restAPI/restAPI.controller.spec.ts on lines 10..22
backend/src/swagger/swagger.service.spec.ts on lines 10..22

Similar blocks of code found in 2 locations. Consider refactoring.
Open

describe('isDirectory', () => {
it('return true for a valid directory and false when not a directory"', async () => {
const goodDirectory = await service.isDirectory(
cachePath + '/devopslibrary/sampledata/datacenters',
);
Severity: Major
Found in backend/src/restAPI/restAPI.service.spec.ts and 1 other location - About 3 hrs to fix
backend/src/restAPI/restAPI.service.spec.ts on lines 120..129

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export interface Commit {
id: string;
tree_id: string;
distinct: boolean;
message: string;
Severity: Major
Found in backend/src/webhook/webhook.dto.ts and 1 other location - About 3 hrs to fix
backend/src/webhook/webhook.dto.ts on lines 187..199

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export interface HeadCommit {
id: string;
tree_id: string;
distinct: boolean;
message: string;
Severity: Major
Found in backend/src/webhook/webhook.dto.ts and 1 other location - About 3 hrs to fix
backend/src/webhook/webhook.dto.ts on lines 161..173

Similar blocks of code found in 2 locations. Consider refactoring.
Open

describe('isFile', () => {
it('return true for a valid file and false when not a file"', async () => {
const goodFile = await service.isFile(
cachePath + '/devopslibrary/sampledata/datacenters/ind01pr.json',
);
Severity: Major
Found in backend/src/restAPI/restAPI.service.spec.ts and 1 other location - About 3 hrs to fix
backend/src/restAPI/restAPI.service.spec.ts on lines 107..118

Similar blocks of code found in 2 locations. Consider refactoring.
Open

{
id: 'f65d651a410ed6d71d077b7714fe01bbc3c56e4a',
tree_id: '59195a157ebeebfe17023c95e640cd8e401027c7',
distinct: true,
message: 'Update ind01pr.json',
Severity: Major
Found in backend/src/webhook/webhook.controller.spec.ts and 1 other location - About 3 hrs to fix
backend/src/webhook/webhook.controller.spec.ts on lines 252..273

Similar blocks of code found in 2 locations. Consider refactoring.
Open

head_commit: {
id: 'f65d651a410ed6d71d077b7714fe01bbc3c56e4a',
tree_id: '59195a157ebeebfe17023c95e640cd8e401027c7',
distinct: true,
message: 'Update ind01pr.json',
Severity: Major
Found in backend/src/webhook/webhook.controller.spec.ts and 1 other location - About 3 hrs to fix
backend/src/webhook/webhook.controller.spec.ts on lines 229..250

Function getCommonKeysWithinArrayOfObjects has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

getCommonKeysWithinArrayOfObjects(objectArray): string[] {
// Get all unique keys across all Objects
let allKeys = [];
for (const object of objectArray) {
if (Array.isArray(object)) {
Severity: Minor
Found in backend/src/schema/schema.service.ts - About 2 hrs to fix

File webhook.controller.spec.ts has 278 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Test, TestingModule } from '@nestjs/testing';
import { WebhookController } from './webhook.controller';
import { WebhookService } from './webhook.service';
import { Webhook } from './webhook.dto';
import { GitModule } from '../git/git.module';
Severity: Minor
Found in backend/src/webhook/webhook.controller.spec.ts - About 2 hrs to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    it('should allow a read user permission to read', async () => {
    nock('https://api.github.com')
    .get(
    '/repos/devopslibrary/sampledata/collaborators/testuser/permission',
    )
    Severity: Major
    Found in backend/src/auth/auth.service.spec.ts and 2 other locations - About 2 hrs to fix
    backend/src/auth/auth.service.spec.ts on lines 37..50
    backend/src/auth/auth.service.spec.ts on lines 123..136

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    it('should allow a write user permission to read', async () => {
    nock('https://api.github.com')
    .get(
    '/repos/devopslibrary/sampledata/collaborators/testuser/permission',
    )
    Severity: Major
    Found in backend/src/auth/auth.service.spec.ts and 2 other locations - About 2 hrs to fix
    backend/src/auth/auth.service.spec.ts on lines 37..50
    backend/src/auth/auth.service.spec.ts on lines 80..93

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    it('should allow an admin user permission to read', async () => {
    nock('https://api.github.com')
    .get(
    '/repos/devopslibrary/sampledata/collaborators/testuser/permission',
    )
    Severity: Major
    Found in backend/src/auth/auth.service.spec.ts and 2 other locations - About 2 hrs to fix
    backend/src/auth/auth.service.spec.ts on lines 80..93
    backend/src/auth/auth.service.spec.ts on lines 123..136

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    it('should disallow a read user permission to admin', async () => {
    nock('https://api.github.com')
    .get(
    '/repos/devopslibrary/sampledata/collaborators/testuser/permission',
    )
    Severity: Major
    Found in backend/src/auth/auth.service.spec.ts and 1 other location - About 2 hrs to fix
    backend/src/auth/auth.service.spec.ts on lines 65..78
    Severity
    Category
    Status
    Source
    Language