Showing 37 of 99 total issues
Function main
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function main() {
const changelog = getChangelog();
const toots: string[] = [];
const split = changelog
Function cdkApplyPrincipals
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected cdkApplyPrincipals() {
if (!this.cdkPrincipalsApplied) {
const mode = this.useNotPrincipal ? 'addNotPrincipals' : 'addPrincipals';
// @ts-ignore only available after swapping 1-base
this[mode](...this.cdkPrincipals);
Function requestWithRetry
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function requestWithRetry(
url: string,
options: request.CoreOptions = {},
retries = 3,
backoff = 300,
Function getAwsServicesFromIamDocs
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getAwsServicesFromIamDocs(): Promise<string[]> {
return new Promise((resolve, reject) => {
const url =
'https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_actions-resources-contextkeys.html';
requestWithRetry(url)
Function add
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public add(name: string, value: string, description: string) {
this.filesNames.forEach((fileName: string) => {
if (fileName === 'cdk-iam-floyd') {
this.files[fileName].collection
.addMethod({
Function createIndex
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createIndex() {
const filePath = './lib/generated/index.ts';
process.stdout.write('index: '.white);
process.stdout.write('Generating '.cyan);
Function indexManagedPolicies
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function indexManagedPolicies(): Promise<void> {
console.log('starting');
const managedPolicies = new ManagedPolicies();
const policyNames: string[] = [];
const policies = await getPolicies();
Function run
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function run() {
const args = process.argv.slice(2);
const doFileSwap = !args.length || args.includes('--swap');
const doPackageJson = !args.length || args.includes('--package-json');
Function conditionFixer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function conditionFixer(
service: string,
condition: Condition,
): Condition {
let fixed = 0;
- 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 8 arguments (exceeds 4 allowed). Consider refactoring. Open
language,
effect,
service,
actions,
resources,
Function splitActionsByService
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function splitActionsByService(actions) {
const serviceActions = {};
for (let action of actions) {
const split = action.split(':');
if (split.length == 1 && action != '*') {
- 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 run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function run() {
const args = process.argv.slice(2);
const doFileSwap = !args.length || args.includes('--swap');
const doPackageJson = !args.length || args.includes('--package-json');
- 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 fixPolicyStatement
has a Cognitive Complexity of 7 (exceeds 5 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(
- 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 toJSON
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public toJSON(): any {
// @ts-ignore only available after swapping 1-base
if (typeof this.addResources == 'function') {
this.cdkApplyActions();
return super.toJSON();
- 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 if
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public if(key: string, value: any, operator?: Operator | string) {
if (this.servicePrefix.length && key.indexOf(':') < 0) {
key = `${this.servicePrefix}:${key}`;
}
- 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 makeMethodCall
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function makeMethodCall(method, params = []) {
let code = '.' + method + '(';
if (params.length) {
const paramList = [];
for (let param of params) {
- 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 toString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public toString() {
let value = this.base;
if (this.base.length == 0) {
throw new Error('No operator set');
- 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"