Inlife/nexrender

View on GitHub

Showing 51 of 75 total issues

Function exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = (job, settings, { input, output, useJobId }, type) => {
    if (type != 'postrender') {
        throw new Error(`Action ${name} can be only run in postrender mode, you provided: ${type}.`)
    }

Severity: Minor
Found in packages/nexrender-action-copy/index.js - About 45 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

Function getCredentials has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const getCredentials = params => {
    if (params && params.profile) {
        // will throw if the profile is not configured
        return new AWS.SharedIniFileCredentials({ profile: params.profile })
    } else if (params && params.accessKeyId && params.secretAccessKey) {
Severity: Minor
Found in packages/nexrender-provider-s3/src/index.js - About 35 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

Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = actionType => (job, settings) => {
    settings.logger.log(`[${job.uid}] applying ${actionType} actions...`);

    return PromiseSerial((job.actions[actionType] || []).map(action => () => {
        settings.track(`Job Action Started`, {
Severity: Minor
Found in packages/nexrender-core/src/tasks/actions.js - About 35 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

Avoid too many return statements within this function.
Open

        return { accessKeyId: process.env.AWS_ACCESS_KEY, secretAccessKey: process.env.AWS_SECRET_KEY }
Severity: Major
Found in packages/nexrender-provider-s3/src/index.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return requireg('@nexrender/provider-' + protocol).download(job, settings, asset.src, asset.dest, asset.params || {});
    Severity: Major
    Found in packages/nexrender-core/src/tasks/download.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return new Promise((resolve, reject) => {
              file.on('error', (err) => reject(err))
      
              const awsParams = {
                  Bucket: params.bucket,
      Severity: Major
      Found in packages/nexrender-provider-s3/src/index.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                            return Promise.reject(new Error(`Couldn't find module @nexrender/provider-${protocol}, Unknown protocol provided.`))
        Severity: Major
        Found in packages/nexrender-core/src/tasks/download.js - About 30 mins to fix

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

          const predownload = async (job, settings, { cacheDirectory, ttl, cacheAssets }) => {
              // Job template
              await findValidateCache(job.template, settings, cacheDirectory, ttl);
          
              if(cacheAssets){
          Severity: Minor
          Found in packages/nexrender-action-cache/index.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

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

          const getBinary = (job, settings) => {
              return new Promise((resolve, reject) => {
                  const {version} = pkg['ffmpeg-static']
                  const filename = `ffmpeg-${version}${process.platform == 'win32' ? '.exe' : ''}`
                  const fileurl = `https://github.com/eugeneware/ffmpeg-static/releases/download/${version}/${process.platform}-x64`
          Severity: Minor
          Found in packages/nexrender-action-encode/index.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

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

              EnhancedScript.prototype.parseMethodWithArgs = function (parameter) {
                  let value = parameter.value;
                  const methodArgs = [...parameter.value.matchAll(getSearchUsageByMethodRegex(this.keyword, 'arg', "gm"))];
          
                  if (methodArgs.length > 0 ) {
          Severity: Minor
          Found in packages/nexrender-core/src/tasks/script/EnhancedScript.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

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

          const postdownload = async (job, settings, { cacheDirectory, cacheAssets }) => {
              // Job template
              await saveCache(job.template, settings, job.workpath, cacheDirectory);
          
              if(cacheAssets){
          Severity: Minor
          Found in packages/nexrender-action-cache/index.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