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';
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: [],
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: [],
- 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 makeStatementCode
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
function makeStatementCode(
language,
effect,
service,
actions,
- 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
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;
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
Function makeStatementCode
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeStatementCode(
language,
effect,
service,
actions,
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;
}
- 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 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;
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;
}
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);
});
File fixes.ts
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { get } from 'lodash';
import { Condition } from './condition';
const colors = require('colors/safe');
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);
PolicyStatementWithPrincipal
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export class PolicyStatementWithPrincipal extends PolicyStatementWithArnDefaults {
protected useNotPrincipal = false;
protected myPrincipals: Principals = {};
/**
Function constructor
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
const project = new Project();
project.manipulationSettings.set({
quoteKind: QuoteKind.Single,
});
Function arnFixer
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function arnFixer(
service: string,
resource: string,
arn: string,
): string {
Function conditionFixer
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function conditionFixer(
service: string,
condition: Condition,
): Condition {
let fixed = 0;
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);
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(
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');