sillsdev/appbuilder-portal

View on GitHub

Showing 323 of 323 total issues

File WorkflowProductActionProvider.cs has 617 lines of code (exceeds 250 allowed). Consider refactoring.
Open

using System;
using System.Collections.Generic;
using System.Linq;
using OptimaJet.Workflow.Core.Model;
using OptimaJet.Workflow.Core.Runtime;

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

    class ListOrganization extends React.Component<IProps> {
      showAddForm = (e) => {
        e.preventDefault();
        const { history } = this.props;
        history.push(addOrganizationPathName);
    source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/product-definitions/list/index.tsx on lines 20..47
    source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/store-types/list/index.tsx on lines 20..44
    source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/workflow-definitions/list/index.tsx on lines 20..47

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

    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 4 locations. Consider refactoring.
    Open

    class ListWorkflowDefinition extends React.Component<IProps> {
      showAddForm = (e) => {
        e.preventDefault();
        const { history } = this.props;
        history.push(addWorkflowDefinitionPathName);
    source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/organizations/list/index.tsx on lines 20..44
    source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/product-definitions/list/index.tsx on lines 20..47
    source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/store-types/list/index.tsx on lines 20..44

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

    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 4 locations. Consider refactoring.
    Open

    class ListStoreType extends React.Component<IProps> {
      showAddForm = (e) => {
        e.preventDefault();
        const { history } = this.props;
        history.push(addStoreTypePathName);
    source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/organizations/list/index.tsx on lines 20..44
    source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/product-definitions/list/index.tsx on lines 20..47
    source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/workflow-definitions/list/index.tsx on lines 20..47

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

    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 4 locations. Consider refactoring.
    Open

    class ListProductDefinition extends React.Component<IProps> {
      showAddForm = (e) => {
        e.preventDefault();
        const { history } = this.props;
        history.push(addProductDefinitionPathName);
    source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/organizations/list/index.tsx on lines 20..44
    source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/store-types/list/index.tsx on lines 20..44
    source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/workflow-definitions/list/index.tsx on lines 20..47

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

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

      render() {
        const { mut } = this;
    
        const {
          name,

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

                  <div className='field m-b-xl'>
                    <label>{t('admin.settings.workflowDefinitions.storeType')}</label>
                    <div className='w-100 thin-bottom-border'>
                      <Dropdown
                        className='custom w-100 no-borders p-sm'
      source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/organizations/common/form.tsx on lines 162..186
      source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/product-definitions/common/form.tsx on lines 200..224
      source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/product-definitions/common/form.tsx on lines 226..250

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

      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 4 locations. Consider refactoring.
      Open

                  <div className='field m-b-xl'>
                    <label>{t('admin.settings.productDefinitions.type')}</label>
                    <div className='w-100 thin-bottom-border'>
                      <Dropdown
                        className='custom w-100 no-borders p-sm'
      source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/organizations/common/form.tsx on lines 162..186
      source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/product-definitions/common/form.tsx on lines 226..250
      source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/workflow-definitions/common/form.tsx on lines 179..203

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

      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 4 locations. Consider refactoring.
      Open

                  <div className='field m-b-xl'>
                    <label>{t('admin.settings.organizations.owner')}</label>
                    <div className='w-100 thin-bottom-border'>
                      <Dropdown
                        className='custom w-100 no-borders p-sm'
      source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/product-definitions/common/form.tsx on lines 200..224
      source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/product-definitions/common/form.tsx on lines 226..250
      source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/workflow-definitions/common/form.tsx on lines 179..203

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

      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 4 locations. Consider refactoring.
      Open

                  <div className='field m-b-xl'>
                    <label>{t('admin.settings.productDefinitions.workflow')}</label>
                    <div className='w-100 thin-bottom-border'>
                      <Dropdown
                        className='custom w-100 no-borders p-sm'
      source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/organizations/common/form.tsx on lines 162..186
      source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/product-definitions/common/form.tsx on lines 200..224
      source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/workflow-definitions/common/form.tsx on lines 179..203

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

      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

      File BuildEngineBuildService.cs has 439 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      using System;
      using System.Linq;
      using Microsoft.EntityFrameworkCore;
      using OptimaJet.DWKit.StarterApplication.Models;
      using SIL.AppBuilder.BuildEngineApiClient;

        Function render has 159 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render() {
            const { mut, toggle } = this;
            const validTypes = [1, 2, 3];
        
            const {

          File ProductService.cs has 420 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          using System;
          using System.Linq;
          using JsonApiDotNetCore.Data;
          using JsonApiDotNetCore.Services;
          using Microsoft.Extensions.Logging;
          Severity: Minor
          Found in source/OptimaJet.DWKit.StarterApplication/Services/ProductService.cs - About 6 hrs to fix

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

            class NewProductDefinition extends React.Component<IProps> {
              save = async (attributes, relationships) => {
                const { createRecord, t } = this.props;
                await createRecord(attributes, relationships);
                toast.success(t('admin.settings.productDefinitions.addSuccess'));
            source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/organizations/new/index.tsx on lines 16..37
            source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/store-types/new/index.tsx on lines 16..37
            source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/workflow-definitions/new/index.tsx on lines 16..37

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

            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 4 locations. Consider refactoring.
            Open

            class NewOrganization extends React.Component<IProps> {
              save = async (attributes, relationships) => {
                const { createRecord, t } = this.props;
                await createRecord(attributes, relationships);
                toast.success(t('admin.settings.organizations.addSuccess'));
            source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/product-definitions/new/index.tsx on lines 16..37
            source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/store-types/new/index.tsx on lines 16..37
            source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/workflow-definitions/new/index.tsx on lines 16..37

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

            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 4 locations. Consider refactoring.
            Open

            class NewWorkflowDefinition extends React.Component<IProps> {
              save = async (attributes, relationships) => {
                const { createRecord, t } = this.props;
                await createRecord(attributes, relationships);
                toast.success(t('admin.settings.workflowDefinitions.workflowAdded'));
            source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/organizations/new/index.tsx on lines 16..37
            source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/product-definitions/new/index.tsx on lines 16..37
            source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/store-types/new/index.tsx on lines 16..37

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

            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 4 locations. Consider refactoring.
            Open

            class NewStoreType extends React.Component<IProps> {
              save = async (attributes, relationships) => {
                const { createRecord, t } = this.props;
                await createRecord(attributes, relationships);
                toast.success(t('admin.settings.storeType.addSuccess'));
            source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/organizations/new/index.tsx on lines 16..37
            source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/product-definitions/new/index.tsx on lines 16..37
            source/SIL.AppBuilder.Portal.Frontend/src/ui/routes/admin/settings/workflow-definitions/new/index.tsx on lines 16..37

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

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

              render() {
                const { mut, toggle } = this;
            
                const {
                  name,

              Function TransitionDetails has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function TransitionDetails({ product }: IProps) {
                const { t } = useTranslations();
                const { dataStore } = useOrbit();
              
                const store: StoreResource = dataStore.cache.query((q) => q.findRelatedRecord(product, 'store'));

              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

              Method ProcessImportData has 122 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public async Task ProcessImportData(int id)
                      {
                          var projectImport = await projectImportRepository.Get()
                              .Where(pi => pi.Id == id)
                              .Include(pi => pi.Organization)
                Severity
                Category
                Status
                Source
                Language