Inlife/nexrender

View on GitHub

Showing 75 of 75 total issues

Function exports has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = (settings) => {
    const targetScript  = 'commandLineRenderer.jsx';

    const patched      = getContentForPatch(settings.binary)
    const afterEffects = path.dirname(settings.binary)
Severity: Major
Found in packages/nexrender-core/src/helpers/patch.js - About 2 hrs to fix

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

    module.exports = (job, settings, { input, provider, params, ...options }, type) => {
        let onProgress;
        let onComplete;
    
        if (type != 'postrender') {
    Severity: Minor
    Found in packages/nexrender-action-upload/index.js - About 2 hrs 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 upload has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const upload = (job, settings, src, params, onProgress, onComplete) => {
        const file = fs.createReadStream(src);
    
        if (!params.endpoint && !params.region) {
            return Promise.reject(new Error('S3 region or endpoint not provided.'))
    Severity: Major
    Found in packages/nexrender-provider-s3/src/index.js - About 2 hrs to fix

      File render.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      const fs = require('fs')
      const path = require('path')
      const {spawn} = require('child_process')
      const {expandEnvironmentVariables, checkForWSL} = require('../helpers/path')
      
      
      Severity: Minor
      Found in packages/nexrender-core/src/tasks/render.js - About 2 hrs to fix

        Function upload has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const upload = (job, settings, src, params) => {
            if (!params.bucket) {
                return Promise.reject(new Error('GCS bucket not provided.'))
            }
            if (!params.item) {
        Severity: Minor
        Found in packages/nexrender-provider-gs/src/index.js - About 1 hr to fix

          Function getBinary has 45 lines of code (exceeds 25 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 1 hr to fix

            Function exports has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = (job, settings) => {
                settings.logger.log(`[${job.uid}] setting up job...`);
            
                try {
                    assert(validate(job) == true)
            Severity: Minor
            Found in packages/nexrender-core/src/tasks/setup.js - About 1 hr to fix

              Function upload has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const upload = (job, settings, src, params) => {
                  if (!params.host) throw new Error('FTP Host not provided.')
                  if (!params.port) throw new Error('FTP Port not provided.')
                  if (!params.user) throw new Error('FTP Username not provided.')
                  if (!params.password) throw new Error('FTP Password not provided.')
              Severity: Minor
              Found in packages/nexrender-provider-ftp/src/index.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                    if (event == 'Job Cleanup') {
                        const events = Object.keys(cache.data)
                
                        for (let i = 0; i < events.length; i++) {
                            const combinedEvent = events[i]
                Severity: Critical
                Found in packages/nexrender-core/src/helpers/analytics.js - About 1 hr to fix

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                                  if (fs.existsSync(logPath)) {
                                      settings.logger.log(`[${job.uid}] dumping aerender log:`)
                                      settings.logger.log(fs.readFileSync(logPath, 'utf8'))
                                  }
                  Severity: Major
                  Found in packages/nexrender-core/src/tasks/render.js and 1 other location - About 1 hr to fix
                  packages/nexrender-core/src/tasks/render.js on lines 310..313

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 67.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                                  if (fs.existsSync(logPath)) {
                                      settings.logger.log(`[${job.uid}] dumping aerender log:`)
                                      settings.logger.log(fs.readFileSync(logPath, 'utf8'))
                                  }
                  Severity: Major
                  Found in packages/nexrender-core/src/tasks/render.js and 1 other location - About 1 hr to fix
                  packages/nexrender-core/src/tasks/render.js on lines 257..260

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 67.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                  module.exports = (job, settings, options/*, type */) => {
                      settings.logger.log(`[${job.uid}] starting action-encode action (ffmpeg)`)
                  
                      return new Promise((resolve, reject) => {
                          const params = constructParams(job, settings, options);
                  Severity: Minor
                  Found in packages/nexrender-action-encode/index.js - About 1 hr to fix

                    Function validate has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const validate = job => {
                        assert(job.uid, 'job must have uid');
                        assert(job.state, 'job must have state');
                    
                        assert(job.template, 'job must have template object defined');
                    Severity: Minor
                    Found in packages/nexrender-types/job.js - About 1 hr to fix

                      Function withEventEmitter has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const withEventEmitter = (wrappedFetch, job, polling = NEXRENDER_JOB_POLLING) => {
                          const emitter  = new EventEmitter();
                          const interval = setInterval(async () => {
                              try {
                                  const updatedJob = await wrappedFetch(`/jobs/${job.uid}/status`)
                      Severity: Minor
                      Found in packages/nexrender-api/src/job.js - About 1 hr 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 wrappedFetch has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          const wrappedFetch = async (path, options) => {
                              options = options || {}
                              const defaultHeaders = {};
                      
                              if (headers) {
                      Severity: Minor
                      Found in packages/nexrender-api/src/index.js - About 1 hr to fix

                        Function exports has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = async (req, res) => {
                            const release = await mutex.acquire();
                        
                            try{
                                console.log(`fetching a pickup job for a worker`)
                        Severity: Minor
                        Found in packages/nexrender-server/src/routes/jobs-pickup.js - About 1 hr to fix

                          Function buildParameterConfigurator has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              EnhancedScript.prototype.buildParameterConfigurator = function () {
                                  const defaultGlobalValue = this.getStringifiedDefaultValue( this.defaults.global );
                                  // const defaultFnValue = this.getDefaultValue( this.defaults.function );
                                  const createParameterConfigurator = () => `
                                      function ParameterConfigurator () {
                          Severity: Minor
                          Found in packages/nexrender-core/src/tasks/script/EnhancedScript.js - About 1 hr to fix

                            Function exports has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            module.exports = (job, settings) => {
                                settings.logger.log(`[${job.uid}] running script assemble...`);
                            
                                const data = [];
                                const base = job.workpath;
                            Severity: Minor
                            Found in packages/nexrender-core/src/tasks/script/index.js - About 1 hr to fix

                              Function init has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const init = (settings) => {
                                  settings = Object.assign({}, settings);
                                  settings.logger = settings.logger || console;
                                  settings.track = (...args) => track(settings, ...args);
                                  settings.trackCombined = (event, params) => track(settings, event, { combined: true, ...params });
                              Severity: Minor
                              Found in packages/nexrender-core/src/index.js - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                              module.exports = (job, settings) => {
                                  settings.logger.log(`[${job.uid}] setting up job...`);
                              
                                  try {
                                      assert(validate(job) == true)
                              Severity: Minor
                              Found in packages/nexrender-core/src/tasks/setup.js - About 1 hr 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