opf/openproject

View on GitHub

Showing 620 of 1,668 total issues

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

  private initializeDatepicker() {
    this.datePickerInstance?.destroy();
    this.datePickerInstance = new DatePicker(
      this.injector,
      '#flatpickr-input',

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

  private filterAlreadyApplied(change:WorkPackageChangeset|{ [id:string]:unknown }, filter:{ id:string, values:unknown[] }):boolean {
    const value:unknown = change instanceof WorkPackageChangeset ? change.projectedResource[filter.id] : change[filter.id];
    const current = _.castArray(value);

    for (let i = 0; i < filter.values.length; i++) {

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

  private warnIfNoOptions(values:unknown[]) {
    let hasMember = false;
    if (values.length === 0) {
      if (this.ngSelectComponent.ngSelectInstance.searchTerm !== undefined && this.ngSelectComponent.ngSelectInstance.searchTerm !== '') {
        hasMember = true;

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

  public buildCell(workPackage:WorkPackageResource, column:QueryColumn):HTMLElement|null {
    // handle relation types
    if (isRelationColumn(column)) {
      return this.relationCellBuilder.build(workPackage, column);
    }

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

  parse<T>(href:string):T {
    if (!href.startsWith(this.bcfApiBase)) {
      throw new Error(`Cannot parse ${href} into BCF resource.`);
    }

Severity: Minor
Found in frontend/src/app/features/bim/bcf/api/bcf-api.service.ts - 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 getTimeSlicesForHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function getTimeSlicesForHeader(vp:TimelineViewParameters,
  unit:moment.unitOfTime.DurationConstructor,
  startView:Moment,
  endView:Moment) {
  const inViewport:[Moment, Moment][] = [];

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

export function Attachable<TBase extends Constructor<HalResource>>(Base:TBase) {
  return class extends Base {
    public attachments:AttachmentCollectionResource;

    /**
Severity: Minor
Found in frontend/src/app/features/hal/resources/mixins/attachable-mixin.ts - 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 reloadSidemenu has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private reloadSidemenu(selectedQueryId:string|null):void {
    const menuIdentifier:string|undefined = this.$state.current.data.sidemenuId;

    if (menuIdentifier) {
      const menu = (document.getElementById(menuIdentifier) as HTMLElement&TurboElement);

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

  public deferInsertion(workPackage:WorkPackageResource):boolean {
    const ancestors = workPackage.getAncestors();

    // Will only defer if at least one ancestor exists
    if (ancestors.length === 0) {

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

  protected displayDurationForDate(renderInfo:RenderInfo, date:Moment):number {
    const { workPackage } = renderInfo;
    let duration = Number(moment.duration(workPackage.duration || 'P1D').asDays().toFixed(0));

    if (workPackage.ignoreNonWorkingDays) {

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

  private buildItems() {
    const items = this.viewerBridgeService.shouldShowViewer
      ? [bcfViewerViewIdentifier, bcfCardsViewIdentifier, bcfSplitViewCardsIdentifier, bcfSplitViewTableIdentifier, bcfTableViewIdentifier]
      : [bcfCardsViewIdentifier, bcfTableViewIdentifier];

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 method.
Open

        return error_result(I18n.t(:error_image_size))
Severity: Major
Found in modules/avatars/app/services/avatars/update_service.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return false
    Severity: Major
    Found in app/validators/secure_context_uri_validator.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return true if browser.edge? && version < 109
      Severity: Major
      Found in app/helpers/browser_helper.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return if remaining_work.nil? || remaining_work.negative?
        Severity: Major
        Found in app/services/work_packages/set_attributes_service.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return true if admin_and_all_granted_to_admin?(permissions)
          Severity: Major
          Found in app/services/authorization/user_permissible_service.rb - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return 'warning';

              Avoid too many return statements within this function.
              Open

                      return 'minus1';

                Avoid too many return statements within this function.
                Open

                        return 'reminder';

                  Avoid too many return statements within this function.
                  Open

                          return 'not-supported';
                    Severity
                    Category
                    Status
                    Source
                    Language