Showing 8 of 8 total issues
Function default
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function () {
let collector = {
stats: {
ec2Objects: {
snapshots: 0,
Function listEBS
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
listEBS () {
let warnings = [];
return new Promise( (resolve, reject) => {
let ec2 = new AWS.EC2();
Function listSnapshots
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
listSnapshots () {
let warnings = [];
return new Promise((resolve, reject) => {
let ec2 = new AWS.EC2();
Function printSnaplist
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var printSnaplist = (snapshots, verbose) => {
if (verbose /* implement verbose flag later */) {
log('AWSBM Backups');
log(headingLine);
if (snapshots.length === 0) {
Function printSnaplist
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
var printSnaplist = (snapshots, verbose) => {
if (verbose /* implement verbose flag later */) {
log('AWSBM Backups');
log(headingLine);
if (snapshots.length === 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 _tagSnapshot
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
let _tagSnapshot = (snapshot, action) => {
let ec2 = new AWS.EC2();
let madeDate = moment(snapshot.StartTime, 'ddd MMM DD YYYY HH:mm:ss ZZ');
let tags = [{
Key: 'backups:config-v0',
Function printEBSList
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var printEBSList = (volumes) => {
log('AWSBM Volumes');
log(headingLine);
if (volumes.length === 0) {
log('No volumes with valid backups:config-v0 tag found');
Function checkAndCreateLogStream
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
let checkAndCreateLogStream = (group, stream) => {
var cloudwatchlogs = new AWS.CloudWatchLogs();
return new Promise((resolve, reject) => {
cloudwatchlogs.describeLogStreams({