Showing 8 of 11 total issues
File index.js
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict'
const minifyScriptWithBabel = require('babel-minify')
const { transform: transformWithESBuild } = require('esbuild')
const { minify: minifySwc } = require('@swc/core')
Function printResult
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function printResult ({ error, file, originalSize, minifiedSize, gzippedSize, brotliedSize }) {
if (error) {
printError(file, error)
} else {
let sizes = []
- 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 convertError
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function convertError ({ message, line, col }) {
const error = { message }
if (line) {
error.message = message
error.reason = message
- 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 computeTotalSizes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function computeTotalSizes (results) {
const accumulator = { total: true, originalSize: 0, minifiedSize: 0, gzippedSize: 0, brotliedSize: 0 }
for (const { error, originalSize, minifiedSize, gzippedSize, brotliedSize } of results) {
if (!error) {
accumulator.originalSize += originalSize
- 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 estimateSizes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
async function estimateSizes (language, { file, source, size: originalSize, error }, gzip, brotli, minifier, sourceType) {
Function collectResults
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
async function collectResults (language, generator, gzip, brotli, minifier, sourceType) {
Function minifyByType
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
async function minifyByType (file, language, source, minifier, sourceType) {
Function estimateSizes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async function estimateSizes (language, { file, source, size: originalSize, error }, gzip, brotli, minifier, sourceType) {
if (error) {
return { file, error: convertError(error) }
}
try {
- 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"