APTrust/dart

View on GitHub

Showing 103 of 237 total issues

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

    constructor(name, writeFn) {
        super();

        if (typeof writeFn != 'function') {
            throw new Error(Context.y18n.__('Param %s must be a function', 'writeFn'));
Severity: Minor
Found in plugins/formats/write/base_writer.js - About 1 hr to fix

    Function _writeManifests has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        async _writeManifests(payloadOrTag) {
            var profile = this.job.bagItProfile;
            var manifestAlgs = profile.chooseManifestAlgorithms('manifest');
            var fileNamePrefix = 'manifest';
            if (payloadOrTag == 'tag') {
    Severity: Minor
    Found in bagit/bagger.js - About 1 hr to fix

      Function chooseManifestAlgorithms has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          chooseManifestAlgorithms(whichType) {
              if (whichType != 'manifest' && whichType != 'tagmanifest') {
                  throw Context.y18n.__("Param whichType must be either 'manifest' or 'tagmanifest'");
              }
              let required = this.manifestsRequired;
      Severity: Minor
      Found in bagit/bagit_profile.js - About 1 hr to fix

        Function _listBagItSerializations has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _listBagItSerializations() {
                let none = Context.y18n.__('None');
                let formats = [{ id: '', name: none }];
                let profile = null;
                if (this.fields.bagItProfileId.value) {
        Severity: Minor
        Found in ui/forms/job_package_op_form.js - About 1 hr to fix

          Function run has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function run() {
              process.on('uncaughtException', function (error) {
                  console.error(error);
                  Context.logger.error(error);
              });
          Severity: Minor
          Found in main.js - About 1 hr to fix

            Function createWindow has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function createWindow() {
                // Create the browser window.
                win = new BrowserWindow({
                    width: 1200,
                    height: 900,
            Severity: Minor
            Found in ui/main.js - About 1 hr to fix

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

                  list() {
                      var tarReader = this;
                      var extract = tar.extract();
                      tarReader.fileCount = 0;
                      tarReader.dirCount = 0;
              Severity: Minor
              Found in plugins/formats/read/tar_reader.js - About 1 hr to fix

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

                    parseFromDOM() {
                        // This is required for jest tests.
                        if ($ === undefined) {
                            var $ = require('jquery');
                        }
                Severity: Minor
                Found in ui/forms/form.js - About 1 hr to fix

                  Function profileFromStandardObject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      static profileFromStandardObject(obj) {
                          if (BagItUtil.guessProfileType(obj) != 'bagit_profiles') {
                              throw Context.y18n.__("Object does not look like a BagIt profile");
                          }
                          var p = new BagItProfile();
                  Severity: Minor
                  Found in bagit/bagit_util.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 _validateManifestEntries has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      _validateManifestEntries(manifestType) {
                          var manifests = this.payloadManifests();
                          if (manifestType === Constants.TAG_MANIFEST) {
                              manifests = this.tagManifests();
                          }
                  Severity: Minor
                  Found in bagit/validator.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 uploadedAt has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      uploadedAt() {
                          var uploadedAt = null;
                          if (this.uploadOps.length > 0) {
                              for (let uploadOp of this.uploadOps) {
                                  for (let result of uploadOp.results) {
                  Severity: Minor
                  Found in core/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 _writeIntoArchive has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function _writeIntoArchive(data, done) {
                      if (!fs.existsSync(path.dirname(data.dest))) {
                          try {
                              mkdirp.sync(path.dirname(data.dest), { mode: 0o755 });
                          } catch (err) {
                  Severity: Minor
                  Found in plugins/formats/write/file_system_writer.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 title has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      get title() {
                          // Try to get the name of the file that was created or uploaded.
                          var name = null;
                          if (!name && this.packageOp && this.packageOp.packageName) {
                              name = path.basename(this.packageOp.packageName);
                  Severity: Minor
                  Found in core/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 uploadAttempted has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      uploadAttempted() {
                          if (this.uploadOps) {
                              for (let op of this.uploadOps) {
                                  for (let result of op.results) {
                                      if (result.attempt > 0) {
                  Severity: Minor
                  Found in core/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 writeFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function writeFile(data, done) {
                      try {
                          var reader = fs.createReadStream(data.bagItFile.absSourcePath);
                  
                          reader.on('error', function(err) {
                  Severity: Minor
                  Found in plugins/formats/write/tar_writer.js - About 1 hr to fix

                    Function _validateSerialization has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _validateSerialization() {
                            var validFormat = true;
                            if (!this.disableSerializationCheck) {
                                var checkSerializationFormat = true;
                                var bagIsDirectory = fs.statSync(this.pathToBag).isDirectory();
                    Severity: Minor
                    Found in bagit/validator.js - About 1 hr to fix

                      Function _init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _init() {
                              var profiles = BagItProfile.list(null, {
                                  limit: 0,
                                  offset: 0,
                                  orderBy: 'name',
                      Severity: Minor
                      Found in ui/forms/new_bagit_profile_form.js - About 1 hr to fix

                        Function _processResponses has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            _processResponses(controller) {
                                let form = new SettingsResponseForm(importedSettings);
                                let responses = form.getResponses();
                                let hasEmptyAnswers = false;
                                let errors = '';
                        Severity: Minor
                        Found in ui/controllers/settings_controller.js - About 1 hr to fix

                          Function _validatePayloadOxum has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              _validatePayloadOxum() {
                                  //Context.logger.info(`Validator: Validating Payload-Oxum in ${this.pathToBag}`);
                                  let found = false;
                                  let bagInfo = this.files["bag-info.txt"];
                                  if (bagInfo && bagInfo.keyValueCollection) {
                          Severity: Minor
                          Found in bagit/validator.js - About 1 hr to fix

                            Function list has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                list() {
                                    var fsReader = this;
                                    var stream = readdirp(fsReader.pathToDirectory, OPTS);
                                    fsReader.fileCount = 0;
                                    fsReader.dirCount = 0;
                            Severity: Minor
                            Found in plugins/formats/read/file_system_reader.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language