MikaAK/s3-plugin-webpack

View on GitHub

Showing 5 of 7 total issues

File s3_plugin.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import http from 'http'
import https from 'https'
import fs from 'fs'
import path from 'path'
import ProgressBar from 'progress'
Severity: Minor
Found in src/s3_plugin.js - About 2 hrs to fix

    exports has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    module.exports = class S3Plugin {
      constructor(options = {}) {
        var {
          include,
          exclude,
    Severity: Minor
    Found in src/s3_plugin.js - About 2 hrs to fix

      Function constructor has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        constructor(options = {}) {
          var {
            include,
            exclude,
            progress,
      Severity: Minor
      Found in src/s3_plugin.js - About 1 hr to fix

        Function invalidateCloudfront has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          invalidateCloudfront() {
            const {clientConfig, cloudfrontInvalidateOptions} = this
        
            if (cloudfrontInvalidateOptions.DistributionId) {
              const {accessKeyId, secretAccessKey, sessionToken} = clientConfig.s3Options
        Severity: Minor
        Found in src/s3_plugin.js - About 1 hr to fix

          Function testRule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export const testRule = (rule, subject) => {
            if (_.isRegExp(rule)) {
              return rule.test(subject)
            } else if (_.isFunction(rule)) {
              return !!rule(subject)
          Severity: Minor
          Found in src/helpers.js - About 25 mins to fix

          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

          Severity
          Category
          Status
          Source
          Language