Asymmetrik/ngx-starter

View on GitHub

Showing 31 of 31 total issues

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

    register(filterable: AsyFilterable): void {
        if (!filterable.id) {
            throw Error(`AsyFilterHeaderComponent must be provided with a unique id.`);
        }

Severity: Major
Found in src/app/common/table/filter/asy-filter.directive.ts and 1 other location - About 3 hrs to fix
src/app/common/table/sort/asy-sort.directive.ts on lines 29..39

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 111.

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

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

    register(sortable: AsySortable): void {
        if (!sortable.id) {
            throw Error(`AsySortHeaderComponent must be provided with a unique id.`);
        }

Severity: Major
Found in src/app/common/table/sort/asy-sort.directive.ts and 1 other location - About 3 hrs to fix
src/app/common/table/filter/asy-filter.directive.ts on lines 33..43

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 111.

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 constructor has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    constructor(
        private loadPageFunc: LoadPageFunction<T>,
        public storageKey?: string,
        initialSort: SortChange = {} as SortChange,
        initialSearch = '',
Severity: Major
Found in src/app/common/table/asy-table-data-source.ts - About 2 hrs to fix

    Function provideExampleSiteFeature has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function provideExampleSiteFeature() {
        return makeEnvironmentProviders([
            {
                provide: ADMIN_TOPICS,
                multi: true,
    Severity: Major
    Found in src/app/site/example/provider.ts - About 2 hrs to fix

      Function _loadState has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          _loadState() {
              if (this.storageKey()) {
                  const columnsOrder: string[] = this.storage.getValue(
                      `${this.storageKey()}-columns-order`,
                      []
      Severity: Minor
      Found in src/app/common/table/column-chooser/column-chooser.component.ts - 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

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

      export function provideAuditFeature() {
          return makeEnvironmentProviders([
              {
                  provide: APP_FEATURE_AUDIT,
                  useValue: true
      Severity: Major
      Found in src/app/core/audit/provider.ts and 1 other location - About 2 hrs to fix
      src/app/core/help/provider.ts on lines 10..27

      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 84.

      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

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

      export function provideHelpFeature() {
          return makeEnvironmentProviders([
              {
                  provide: APP_FEATURE_HELP,
                  useValue: true
      Severity: Major
      Found in src/app/core/help/provider.ts and 1 other location - About 2 hrs to fix
      src/app/core/audit/provider.ts on lines 10..27

      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 84.

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

          static format(
              value: string | number | Date | DateTime | null | undefined,
              format?: string
          ): string {
              if (value) {
      Severity: Minor
      Found in src/app/common/pipes/utc-date-pipe/utc-date-utils.service.ts - 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

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

          public hasSomeTeamRoles(team: Pick<Team, '_id'>, roles: Array<string | TeamRole>): boolean {
              return roles.some((role: string | TeamRole) => this.hasTeamRole(team, role));
          }
      Severity: Major
      Found in src/app/core/auth/session.model.ts and 1 other location - About 2 hrs to fix
      src/app/core/auth/session.model.ts on lines 73..75

      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 77.

      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

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

          public hasEveryTeamRole(team: Pick<Team, '_id'>, roles: Array<string | TeamRole>): boolean {
              return roles.every((role: string | TeamRole) => this.hasTeamRole(team, role));
          }
      Severity: Major
      Found in src/app/core/auth/session.model.ts and 1 other location - About 2 hrs to fix
      src/app/core/auth/session.model.ts on lines 69..71

      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 77.

      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 provideAdminFeature has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function provideAdminFeature() {
          return makeEnvironmentProviders([
              {
                  provide: APP_FEATURE_ADMIN,
                  useValue: true
      Severity: Major
      Found in src/app/core/admin/provider.ts - About 2 hrs to fix

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        export const ADMIN_MESSAGES_ROUTES: Routes = [
            {
                path: 'messages',
                component: ListMessagesComponent
            },
        Severity: Major
        Found in src/app/core/admin/messages/admin-messages-routes.ts and 2 other locations - About 1 hr to fix
        src/app/core/admin/end-user-agreement/admin-eua-routes.ts on lines 7..23
        src/app/core/admin/user/admin-user-routes.ts on lines 7..23

        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 64.

        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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        export const ADMIN_EUA_ROUTES: Routes = [
            {
                path: 'euas',
                component: AdminListEuasComponent
            },
        Severity: Major
        Found in src/app/core/admin/end-user-agreement/admin-eua-routes.ts and 2 other locations - About 1 hr to fix
        src/app/core/admin/messages/admin-messages-routes.ts on lines 7..23
        src/app/core/admin/user/admin-user-routes.ts on lines 7..23

        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 64.

        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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        export const ADMIN_USER_ROUTES: Routes = [
            {
                path: 'users',
                component: AdminListUsersComponent
            },
        Severity: Major
        Found in src/app/core/admin/user/admin-user-routes.ts and 2 other locations - About 1 hr to fix
        src/app/core/admin/end-user-agreement/admin-eua-routes.ts on lines 7..23
        src/app/core/admin/messages/admin-messages-routes.ts on lines 7..23

        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 64.

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

            _buildFilter() {
                let $lte = DateTime.invalid('not set');
                let $gte = DateTime.invalid('not set');
        
                if (this.enabled()) {

        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 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(config) {
            config.set({
                basePath: 'src',
                frameworks: ['jasmine', '@angular-devkit/build-angular'],
                plugins: [
        Severity: Minor
        Found in karma.conf.js - About 1 hr to fix

          Function _loadState has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _loadState() {
                  if (this.storageKey()) {
                      const columnsOrder: string[] = this.storage.getValue(
                          `${this.storageKey()}-columns-order`,
                          []
          Severity: Minor
          Found in src/app/common/table/column-chooser/column-chooser.component.ts - About 1 hr to fix

            Function authGuard has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function authGuard(configOrRoles?: string | string[] | Partial<AuthGuardConfig>) {
                return (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {
                    // eslint-disable-next-line deprecation/deprecation
                    const router = inject(Router);
                    const sessionService = inject(SessionService);
            Severity: Minor
            Found in src/app/core/auth/auth.guard.ts - About 1 hr to fix

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

                  public hasEveryRole(roles: Array<string | Role>): boolean {
                      return roles.every((role: string | Role) => this.hasRole(role));
                  }
              Severity: Major
              Found in src/app/core/auth/session.model.ts and 1 other location - About 1 hr to fix
              src/app/core/auth/session.model.ts on lines 46..48

              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 60.

              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

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

                  public hasSomeRoles(roles: Array<string | Role>): boolean {
                      return roles.some((role: string | Role) => this.hasRole(role));
                  }
              Severity: Major
              Found in src/app/core/auth/session.model.ts and 1 other location - About 1 hr to fix
              src/app/core/auth/session.model.ts on lines 50..52

              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 60.

              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

              Severity
              Category
              Status
              Source
              Language