udondan/iam-floyd

View on GitHub

Showing 37 of 99 total issues

File index.ts has 892 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import 'colors';

import * as cheerio from 'cheerio';
import * as fs from 'fs';
import * as glob from 'glob';
Severity: Major
Found in lib/generator/index.ts - About 2 days to fix

    Function createModule has 329 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function createModule(module: Module): Promise<void> {
      const stats: Stats = {
        actions: [],
        conditions: [],
        resources: [],
    Severity: Major
    Found in lib/generator/index.ts - About 1 day to fix

      Function createModule has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
      Open

      export function createModule(module: Module): Promise<void> {
        const stats: Stats = {
          actions: [],
          conditions: [],
          resources: [],
      Severity: Minor
      Found in lib/generator/index.ts - About 1 day to fix

      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 makeStatementCode has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

      function makeStatementCode(
        language,
        effect,
        service,
        actions,
      Severity: Minor
      Found in docs/source/_static/js/policy-converter.js - About 6 hrs to fix

      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

      File policy-converter.js has 415 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var preferredLanguage = 'TypeScript';
      var preferredVariant = 'CDK';
      var preferredImports = 'Yes';
      
      var selectFilled = false;
      Severity: Minor
      Found in docs/source/_static/js/policy-converter.js - About 5 hrs to fix

        File 2-conditions.ts has 352 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { Operator } from '../operators';
        import { PolicyStatementBase } from './1-base';
        
        /**
         * A Condition
        Severity: Minor
        Found in lib/shared/policy-statement/2-conditions.ts - About 4 hrs to fix

          Function makeStatementCode has 88 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function makeStatementCode(
            language,
            effect,
            service,
            actions,
          Severity: Major
          Found in docs/source/_static/js/policy-converter.js - About 3 hrs to fix

            Function convert has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

            function convert(convertTarget, data) {
              if (!data.hasOwnProperty('Statement')) {
                setError('Policy has no statements');
                return;
              }
            Severity: Minor
            Found in docs/source/_static/js/policy-converter.js - About 3 hrs to fix

            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 addActions has 78 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function addActions($: cheerio.Root, module: Module): Module {
              const actions: Actions = {};
              const tableActions = getTable($, 'Actions');
            
              let action: string;
            Severity: Major
            Found in lib/generator/index.ts - About 3 hrs to fix

              Function convert has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function convert(convertTarget, data) {
                if (!data.hasOwnProperty('Statement')) {
                  setError('Policy has no statements');
                  return;
                }
              Severity: Major
              Found in docs/source/_static/js/policy-converter.js - About 3 hrs to fix

                Function compactActions has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private compactActions() {
                    // actions that will be included, service prefix is removed
                    const includeActions = this.floydActions.map((elem) => {
                      return elem.substring(elem.indexOf(':') + 1);
                    });
                Severity: Major
                Found in lib/shared/policy-statement/3-actions.ts - About 2 hrs to fix

                  Function constructor has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    constructor(scope: Construct, id: string, props?: StackProps) {
                      super(scope, id, props);
                  
                      Tags.of(scope).add('Project', project);
                  
                  
                  Severity: Major
                  Found in tooter/lib/index.ts - About 2 hrs to fix

                    File fixes.ts has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { get } from 'lodash';
                    
                    import { Condition } from './condition';
                    
                    const colors = require('colors/safe');
                    Severity: Minor
                    Found in lib/generator/fixes.ts - About 2 hrs to fix

                      PolicyStatementWithPrincipal has 21 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export class PolicyStatementWithPrincipal extends PolicyStatementWithArnDefaults {
                        protected useNotPrincipal = false;
                        protected myPrincipals: Principals = {};
                      
                        /**
                      Severity: Minor
                      Found in lib/shared/policy-statement/8-principals.ts - About 2 hrs to fix

                        Function constructor has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          constructor() {
                            const project = new Project();
                            project.manipulationSettings.set({
                              quoteKind: QuoteKind.Single,
                            });
                        Severity: Minor
                        Found in lib/generator/managed-policies.ts - About 1 hr to fix

                          Function arnFixer has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function arnFixer(
                            service: string,
                            resource: string,
                            arn: string,
                          ): string {
                          Severity: Minor
                          Found in lib/generator/fixes.ts - About 1 hr to fix

                            Function conditionFixer has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function conditionFixer(
                              service: string,
                              condition: Condition,
                            ): Condition {
                              let fixed = 0;
                            Severity: Minor
                            Found in lib/generator/fixes.ts - About 1 hr to fix

                              Function getContent has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function getContent(service: string): Promise<Module> {
                                service = serviceFixer(service);
                                process.stdout.write(`${service}: `.white);
                                process.stdout.write('Fetching '.grey);
                              
                              
                              Severity: Minor
                              Found in lib/generator/index.ts - About 1 hr to fix

                                Function fixPolicyStatement has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function fixPolicyStatement(project: Project) {
                                  // loop over files in ../lib/shared/policy-statement:
                                  for (const fileName of fs.readdirSync(`${lib}/shared/policy-statement`)) {
                                    if (fileName.endsWith('.ts') && !fileName.endsWith('.d.ts')) {
                                      const file = path.join(
                                Severity: Minor
                                Found in bin/mkcdk.ts - About 1 hr to fix

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

                                  function addResourceTypes($: cheerio.Root, module: Module): Module {
                                    const resourceTypes: ResourceTypes = {};
                                    const tableResourceTypes = getTable($, 'Resource types');
                                    tableResourceTypes.find('tr').each((_, element) => {
                                      const tds = $(element).find('td');
                                  Severity: Minor
                                  Found in lib/generator/index.ts - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language