APTrust/dart

View on GitHub

Showing 103 of 237 total issues

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

    _ensureDirectories(fileHeader) {
        let template =
        {
            relDestPath: '',
            mode: 0o755,
Severity: Minor
Found in plugins/formats/write/tar_writer.js - About 1 hr to fix

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

        read() {
            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 _readEntry has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          _readEntry(entry) {
              let validator = this;
              if (entry.fileStat.isFile()) {
                  var bagItFile = this._addBagItFile(entry);
                  if (Context.slowMotionDelay > 0) {
      Severity: Minor
      Found in bagit/validator.js - About 55 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 renderPackageInfo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          renderPackageInfo(data, dartProcess) {
              let [detailDiv, progressBar] = this.getDivs(dartProcess, 'packageInfo');
              if (data.action == 'fileAdded') {
                  let shortName = Util.trimToLength(data.msg, 80, 'middle');
                  detailDiv.text(Context.y18n.__('Added file %s', shortName));
      Severity: Minor
      Found in ui/controllers/running_jobs_controller.js - About 55 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 chooseManifestAlgorithms has a Cognitive Complexity of 9 (exceeds 5 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 55 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 _getJobOutcomeAndTimestamp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          _getJobOutcomeAndTimestamp(job) {
              // TODO: This code has some overlap with JobController#colorCodeJobs.
              let outcome = "Job has not been run.";
              let timestamp = null;
              if(job.uploadAttempted()) {
      Severity: Minor
      Found in ui/controllers/dashboard_controller.js - About 55 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 validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          validate() {
              this.errors = {};
              if (typeof this.packageName != 'string' || Util.isEmpty(this.packageName)) {
                  this.errors['PackageOperation.packageName'] = 'Package name is required.';
              }
      Severity: Minor
      Found in core/package_operation.js - About 55 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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          async run() {
              let returnCode = Constants.EXIT_SUCCESS;
              try {
                  returnCode = await this.createPackage();
                  if (returnCode == Constants.EXIT_SUCCESS) {
      Severity: Minor
      Found in workers/job_runner.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 arrayContentsMatch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          static arrayContentsMatch(a, b, orderMatters) {
              if (!Array.isArray(a) || !Array.isArray(b)) {
                  return false;
              }
              if (a === b) {
      Severity: Minor
      Found in core/util.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 deleteRecursive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          static deleteRecursive(filepath) {
              if (filepath.length < 8 || filepath.split(path.sep).length < 3) {
                  throw `${filepath} does not look safe to delete`;
              }
              if (fs.existsSync(filepath)) {
      Severity: Minor
      Found in core/util.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 findCommonPathPrefix has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          static findCommonPathPrefix(paths, pathSep = path.sep) {
              let i = 0;
              let lastPrefix = '';
              let prefix = '';
              let match = true;
      Severity: Minor
      Found in core/util.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 _tagDefToField has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          _tagDefToField(t) {
              var field = new Field(t.id, t.id, t.tagName, t.getValue());
              field.help = t.help;
              if (t.values && t.values.length > 0) {
                  field.choices = Choice.makeList(t.values, t.getValue(), true);
      Severity: Minor
      Found in ui/forms/job_tags_form.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 _ensureDirectories has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          _ensureDirectories(fileHeader) {
              let template =
              {
                  relDestPath: '',
                  mode: 0o755,
      Severity: Minor
      Found in plugins/formats/write/tar_writer.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 updateAPTrustBagItProfiles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function updateAPTrustBagItProfiles() {
          let profile = BagItProfile.find(aptrustProfileId);
          let succeeded = true;
          if (profile) {
              if (!updateProfile(profile)) {
      Severity: Minor
      Found in migrations/20190912T110723Z.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 _getTarOutputWriter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          _getTarOutputWriter() {
              if (this._tarOutputWriter == null) {
                  if (!this.pathToTarFile.endsWith(".tar")) {
                      throw new Error(Context.y18n.__(`pathToTarFile '%s' must have .tar extension`, this.pathToTarFile));
                  }
      Severity: Minor
      Found in plugins/formats/write/tar_writer.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 getRunErrors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          getRunErrors() {
              let errs = [];
              if (this.packageOp && this.packageOp.result) {
                  errs = errs.concat(this.packageOp.result.errors);
              }
      Severity: Minor
      Found in core/job.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          validate() {
              this.errors = {};
              if (Util.isEmpty(this.tagFile)) {
                  this.errors['tagFile'] = "You must specify a tag file.";
              }
      Severity: Minor
      Found in bagit/tag_definition.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 findContainingItem has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          findContainingItem(filepath) {
              if (Array.isArray(this.job.packageOp.sourceFiles)) {
                  for (let item of this.job.packageOp.sourceFiles) {
                      if (item === filepath || (filepath.startsWith(item) && Util.isDirectory(item))) {
                          return item;
      Severity: Minor
      Found in ui/controllers/job_files_controller.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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          validate() {
              this.errors = {};
              super.validate();
              if (Util.isEmptyStringArray(this.acceptBagItVersion)) {
                  this.errors["acceptBagItVersion"] = Context.y18n.__("Profile must accept at least one BagIt version.");
      Severity: Minor
      Found in bagit/bagit_profile.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 loadFixtures has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          static loadFixtures(filenames, type, save = false) {
              let types = ['AppSetting', 'InternalSetting', 'Job',
                           'JobParams', 'RemoteRepository', 'StorageService',
                           'Workflow'];
              if (typeof type.name != 'string' || !types.includes(type.name)) {
      Severity: Minor
      Found in core/test_util.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

      Severity
      Category
      Status
      Source
      Language