oaeproject/Hilary

View on GitHub

Showing 193 of 882 total issues

Function _transferResourcePermissions has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
Open

const _transferResourcePermissions = (
  ctx,
  user,
  archiveUser,
  listElementByMember,
Severity: Minor
Found in packages/oae-principals/lib/definitive-deletion.js - About 1 day 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 transformSearchResults has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

const transformSearchResults = function (ctx, transformers, results, callback) {
  const hits = defaultTo({}, path(['body', 'hits', 'hits'], results));
  const resultsTotalCount = path(['body', 'hits', 'total', 'value'], results);

  if (isEmpty(hits)) return callback(null, new SearchModel.SearchResult(resultsTotalCount, []));
Severity: Minor
Found in packages/oae-search/lib/util.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 PreviewContext has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

const PreviewContext = function (config, contentId, revisionId) {
  const protocol = config.servers.useHttps ? 'https' : 'http';
  const host = config.servers.serverInternalAddress || config.servers.globalAdminHost;
  const strictSSL = config.servers.strictHttps;

Severity: Minor
Found in packages/oae-preview-processor/lib/model.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 getEmailSummary has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

const getEmailSummary = function (util, recipient, activities, baseUrl) {
  if (isEmail(recipient.id)) {
    // For an email invitation, we always use the subject invitation language, even for the
    // summary
    const actors = _getAllEntities(activities, 'actor');
Severity: Minor
Found in packages/oae-activity/emailTemplates/mail.shared.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 replaceLinks has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Confirmed

const replaceLinks = function (body = '') {
  // Replace any matched URLs with relative links in markdown format
  return body.replace(REGEXP_LINK, (fullMatch, preURLChar, host, path, postURLChar, offset) => {
    // If the host doesn't match an OAE tenant we disregard it as it is an external link
    if (not(TenantsAPI.getTenantByHost(host))) return fullMatch;
Severity: Minor
Found in packages/oae-messagebox/lib/api.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 _getLibrary has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

const _getLibrary = (ctx, userId, type, callback) => {
  switch (type) {
    case CONTENT:
      ContentAPI.getContentLibraryItems(ctx, userId, null, null, (error, contents) => {
        if (error) return callback(error);
Severity: Minor
Found in packages/oae-principals/lib/definitive-deletion.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 _getMembers has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

const _getMembers = (ctx, elementId, type, callback) => {
  switch (type) {
    case CONTENT:
      ContentAPI.getContentMembersLibrary(ctx, elementId, null, null, (error, memberList) => {
        if (error) return callback(error);
Severity: Minor
Found in packages/oae-principals/lib/definitive-deletion.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 createUser has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function createUser(ctx, tenantAlias, displayName, options, callback) {
  tenantAlias = tenantAlias || ctx.tenant().alias;
  options = options || {};
  callback =
    callback ||
Severity: Minor
Found in packages/oae-principals/lib/api.user.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 getFileListForFolder has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const getFileListForFolder = function (foldername, callback) {
  fs.stat(foldername, (error, stat) => {
    if (error) {
      return callback(null, []);
    }
Severity: Minor
Found in packages/oae-util/lib/io.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 _initializeDefaultProcessors has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const _initializeDefaultProcessors = function (callback) {
  // Initialize those processors that need it.
  OfficeProcessor.init(config.previews.office, (error) => {
    if (error) {
      return callback(error);
Severity: Minor
Found in packages/oae-preview-processor/lib/api.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 restorePrincipal has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const restorePrincipal = function (principalId, callback) {
  // Determine if the principal was already deleted in the authz index before we unset them and
  // flip the principals deleted flag
  AuthzDelete.isDeleted([principalId], (error, wasDeleted) => {
    if (error) {
Severity: Minor
Found in packages/oae-principals/lib/internal/dao.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 transformActivities has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const transformActivities = function (ctx, activities, transformerType, callback) {
  transformerType = transformerType || 'activitystreams';

  const activityEntitiesByObjectType = {};
  const transformedActivityEntitiesByObjectType = {};
Severity: Minor
Found in packages/oae-activity/lib/internal/transformer.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 incrementNotificationsUnread has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const incrementNotificationsUnread = function (userIdIncrs, callback) {
  /*!
   * First update the cached new notification counts, then update Cassandra. Some very clear drawbacks here but
   * are considered acceptable:
   *
Severity: Minor
Found in packages/oae-activity/lib/internal/notifications.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 initLDAPAuth has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Confirmed

function initLDAPAuth() {
  const strategy = {};

  /**
   * @see oae-authentication/lib/strategy#shouldBeEnabled
Severity: Minor
Found in packages/oae-authentication/lib/strategies/ldap/init.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 _handleRegeneratePreviewsTask has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const _handleRegeneratePreviewsTask = function (data, callback) {
  callback =
    callback ||
    function (error) {
      if (error) {
Severity: Minor
Found in packages/oae-preview-processor/lib/api.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 setupPassportSerializers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const setupPassportSerializers = function (cookieSecret) {
  // Serialize the current user and potential imposter
  // ids into the session cookie
  passport.serializeUser((oaeAuthInfo, done) => {
    const toSerialize = {};
Severity: Minor
Found in packages/oae-authentication/lib/init.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 getPrincipals has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const getPrincipals = function (principalIds, fields, callback) {
  if (_.isEmpty(principalIds)) {
    return callback(null, {});
  }

Severity: Minor
Found in packages/oae-principals/lib/internal/dao.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 augmentContent has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const augmentContent = function (ctx, content, duration, offset) {
  // Generate a signature for this content item. In combination with the previews object, the UI should be able to construct
  // download URLs for the preview items
  content.signature = Signature.createExpiringResourceSignature(ctx, content.id);

Severity: Minor
Found in packages/oae-content/lib/internal/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 emit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

EventEmitter.prototype.emit = function (...args) {
  const log = Log.logger('oae-emitter');

  // The name is required and must be the first argument
  const name = args.shift();
Severity: Minor
Found in packages/oae-emitter/lib/api.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 _createContent has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

  ctx,
  resourceSubType,
  displayName,
  description,
  visibility,
Severity: Major
Found in packages/oae-content/lib/rest.js - About 1 hr to fix
    Severity
    Category
    Status
    Source
    Language