Showing 8 of 12 total issues
Function exec
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
exec(image) {
const acl = this.options.acl;
return new Promise((resolve, reject) => {
console.log("Resizing to: " + (this.options.directory || "in-place"));
Function processImage
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
processImage(imageData, config) {
const acl = config.get("acl");
const cacheControl = config.get("cacheControl");
const bucket = config.get("bucket");
const jpegOptimizer = config.get("jpegOptimizer", "mozjpeg");
Function combineWithDirectory
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
combineWithDirectory(output) {
const prefix = output.prefix || "";
const suffix = output.suffix || "";
const fileName = path.parse(this.baseName).name;
const extension = ( output.keepExtension )
- 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 combineWithDirectory
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
combineWithDirectory(output) {
const prefix = output.prefix || "";
const suffix = output.suffix || "";
const fileName = path.parse(this.baseName).name;
const extension = ( output.keepExtension )
Function process
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function process(s3Object, callback) {
const configPath = path.resolve(__dirname, "config.json");
const fileSystem = new S3FileSystem();
const processor = new ImageProcessor(fileSystem, s3Object);
const config = new Config(
Function parseEvent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function parseEvent(event) {
const eventRecord = event && event.Records && event.Records[0];
if ( eventRecord ) {
if ( eventRecord.eventSource === "aws:s3" && eventRecord.s3 ) {
- 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 processImage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
processImage(imageData, config) {
const acl = config.get("acl");
const cacheControl = config.get("cacheControl");
const bucket = config.get("bucket");
const jpegOptimizer = config.get("jpegOptimizer", "mozjpeg");
- 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
Consider simplifying this complex logical expression. Open
if ( config.exists("reduce") ) {
const reduce = config.get("reduce");
reduce.acl = reduce.acl || acl;
reduce.cacheControl = ( reduce.cacheControl !== undefined ) ? reduce.cacheControl : cacheControl;