devopslibrary/adde

View on GitHub

Showing 53 of 53 total issues

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 4 locations. Consider refactoring.
Open

it('should disallow a read user permission to write', 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 3 other locations - About 2 hrs to fix
backend/src/auth/auth.service.spec.ts on lines 51..64
backend/src/auth/auth.service.spec.ts on lines 137..150
backend/src/auth/auth.service.spec.ts on lines 151..164

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

it('should allow an admin user permission to write', 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 3 other locations - About 2 hrs to fix
backend/src/auth/auth.service.spec.ts on lines 94..107
backend/src/auth/auth.service.spec.ts on lines 137..150
backend/src/auth/auth.service.spec.ts on lines 151..164

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

it('should allow a write user permission to write', 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 3 other locations - About 2 hrs to fix
backend/src/auth/auth.service.spec.ts on lines 51..64
backend/src/auth/auth.service.spec.ts on lines 94..107
backend/src/auth/auth.service.spec.ts on lines 151..164

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

it('should disallow a write 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 3 other locations - About 2 hrs to fix
backend/src/auth/auth.service.spec.ts on lines 51..64
backend/src/auth/auth.service.spec.ts on lines 94..107
backend/src/auth/auth.service.spec.ts on lines 137..150

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

beforeAll(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [AuthModule, ConfigModule],
}).compile();
service = module.get<AuthService>(AuthService);
Severity: Major
Found in backend/src/auth/auth.service.spec.ts and 1 other location - About 1 hr to fix
backend/src/auth/auth.controller.spec.ts on lines 9..15

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

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [BootstrapModule],
}).compile();
 
 
Severity: Major
Found in backend/src/bootstrap/bootstrap.service.spec.ts and 3 other locations - About 1 hr to fix
backend/src/config/config.service.spec.ts on lines 8..13
backend/src/schema/schema.service.spec.ts on lines 7..13
backend/src/github/github.service.spec.ts on lines 9..15

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

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [GithubModule],
}).compile();
 
 
Severity: Major
Found in backend/src/github/github.service.spec.ts and 3 other locations - About 1 hr to fix
backend/src/bootstrap/bootstrap.service.spec.ts on lines 8..14
backend/src/config/config.service.spec.ts on lines 8..13
backend/src/schema/schema.service.spec.ts on lines 7..13

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

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [SchemaService],
}).compile();
 
 
Severity: Major
Found in backend/src/schema/schema.service.spec.ts and 3 other locations - About 1 hr to fix
backend/src/bootstrap/bootstrap.service.spec.ts on lines 8..14
backend/src/config/config.service.spec.ts on lines 8..13
backend/src/github/github.service.spec.ts on lines 9..15

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

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [ConfigModule],
}).compile();
service = module.get<ConfigService>(ConfigService);
Severity: Major
Found in backend/src/config/config.service.spec.ts and 3 other locations - About 1 hr to fix
backend/src/bootstrap/bootstrap.service.spec.ts on lines 8..14
backend/src/schema/schema.service.spec.ts on lines 7..13
backend/src/github/github.service.spec.ts on lines 9..15

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

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [AuthModule, ConfigModule],
}).compile();
 
 
Severity: Major
Found in backend/src/auth/auth.controller.spec.ts and 1 other location - About 1 hr to fix
backend/src/auth/auth.service.spec.ts on lines 27..32

Function getSwagger has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async getSwagger(repoPath): Promise<string> {
const orgName = repoPath.split('/')[0];
const repoName = repoPath.split('/')[1];
const cache = this.configService.get('REPO_CACHE_DIRECTORY') + '/';
const endpointNamesPath = recursiveReadSync(cache + repoPath, {
Severity: Minor
Found in backend/src/swagger/swagger.service.ts - About 1 hr to fix

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

    return this.httpService
    .get(url, {
    headers: {
    Authorization: `token ${installationToken}`,
    Accept: 'application/vnd.github.machine-man-preview+json',
    Severity: Major
    Found in backend/src/github/github.service.ts and 1 other location - About 1 hr to fix
    backend/src/github/github.service.ts on lines 24..34

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

    return this.httpService
    .get(url, {
    headers: {
    Authorization: `Bearer ${appToken}`,
    Accept: 'application/vnd.github.machine-man-preview+json',
    Severity: Major
    Found in backend/src/github/github.service.ts and 1 other location - About 1 hr to fix
    backend/src/github/github.service.ts on lines 61..71

    Function userHasAccess has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    public async userHasAccess(
    githubUser: User,
    role: Role,
    account,
    repo,
    Severity: Minor
    Found in backend/src/auth/auth.service.ts - About 1 hr to fix

      Function generateSchema has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      generateSchema(folderPath: string): any {
      const folderName = folderPath.split('/').pop();
      const jsonData = this.loadJSONinFolder(folderPath);
      const commonProperties = this.getCommonPropertiesWithinArray(jsonData);
      if (commonProperties.length === 0) {
      Severity: Minor
      Found in backend/src/schema/schema.service.ts - About 1 hr to fix

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

        expect(list).toEqual({
        cidr: '172.16.0.0/19',
        dns: { primary: '8.8.8.8', secondary: '4.2.2.9' },
        lastUpdated: '2020-12-30T19:31:99Z',
        name: 'Indianapolis Production Datacenter 01',
        Severity: Major
        Found in backend/src/restAPI/restAPI.service.spec.ts and 2 other locations - About 1 hr to fix
        backend/src/restAPI/restAPI.controller.spec.ts on lines 86..93
        backend/src/restAPI/restAPI.service.spec.ts on lines 83..90

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

        expect(webhookOutput).toMatchObject({
        cidr: '172.16.0.0/19',
        dns: { primary: '8.8.8.8', secondary: '4.2.2.9' },
        lastUpdated: '2020-12-30T19:31:99Z',
        name: 'Indianapolis Production Datacenter 01',
        Severity: Major
        Found in backend/src/restAPI/restAPI.controller.spec.ts and 2 other locations - About 1 hr to fix
        backend/src/restAPI/restAPI.service.spec.ts on lines 83..90
        backend/src/restAPI/restAPI.service.spec.ts on lines 255..262

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

        expect(data).toEqual({
        cidr: '172.16.0.0/19',
        dns: { primary: '8.8.8.8', secondary: '4.2.2.9' },
        lastUpdated: '2020-12-30T19:31:99Z',
        name: 'Indianapolis Production Datacenter 01',
        Severity: Major
        Found in backend/src/restAPI/restAPI.service.spec.ts and 2 other locations - About 1 hr to fix
        backend/src/restAPI/restAPI.controller.spec.ts on lines 86..93
        backend/src/restAPI/restAPI.service.spec.ts on lines 255..262

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

        isDirectory(reqPath): boolean {
        if (fs.existsSync(reqPath) && fs.statSync(reqPath).isDirectory()) {
        return true;
        } else {
        return false;
        Severity: Major
        Found in backend/src/restAPI/restAPI.service.ts and 1 other location - About 1 hr to fix
        backend/src/restAPI/restAPI.service.ts on lines 70..76
        Severity
        Category
        Status
        Source
        Language