packages/standard-minifier-css/plugin/minify-css.js
Function mergeCss
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const mergeCss = Profile("mergeCss", async function (css, postcssConfig) {
// Filenames passed to AST manipulator mapped to their original files
const originals = {};
const deps = [];
Function newMap
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const newMap = await Profile.time("composing source maps", async function () {
const newMap = new sourcemap.SourceMapGenerator();
const concatConsumer = await new sourcemap.SourceMapConsumer(stringifiedCss.map);
// Create a dictionary of source map consumers for fast access
const consumers = Object.create(null);
Function minifyFiles
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async minifyFiles (files, mode, postcssConfig) {
const cacheKey = createCacheKey(files, mode);
const cachedResult = this.cache.get(cacheKey);
if (
Function minifyFiles
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
async minifyFiles (files, mode, postcssConfig) {
const cacheKey = createCacheKey(files, mode);
const cachedResult = this.cache.get(cacheKey);
if (
- 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 astPromises
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const astPromises = css.map(async function (file) {
const filename = file.getPathInBundle();
originals[filename] = file;
let ast;
Function mergeCss
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
const mergeCss = Profile("mergeCss", async function (css, postcssConfig) {
// Filenames passed to AST manipulator mapped to their original files
const originals = {};
const deps = [];
- 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"