Privatix/dapp-gui

View on GitHub

Showing 5,602 of 5,602 total issues

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

                    <div className='form-group row'>
                        <label className='col-3 col-form-label'>{t('MinUnits')}:</label>
                        <div className='col-9'>
                            <div className='input-group bootstrap-touchspin'>
                                <input type='text' className='form-control' value={offering.minUnits} readOnly/>
Severity: Major
Found in src/agent/offerings/offeringView.tsx and 1 other location - About 6 hrs to fix
src/agent/offerings/offeringView.tsx on lines 91..102

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

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

                    <div className='form-group row'>
                        <label className='col-3 col-form-label'>{t('MaxBillingUnitLag')}:</label>
                        <div className='col-9'>
                            <div className='input-group bootstrap-touchspin'>
                                <input type='text' className='form-control' value={offering.maxBillingUnitLag} readOnly/>
Severity: Major
Found in src/agent/offerings/offeringView.tsx and 1 other location - About 6 hrs to fix
src/agent/offerings/offeringView.tsx on lines 103..114

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

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

    render(){

        const { t, offering, localSettings, accounts, serviceName } = this.props;
        const { account, customDeposit, thereAreActiveChannels, gasPrice } = this.state;

Severity: Major
Found in src/client/vpn_list/acceptOffering.tsx - About 6 hrs to fix

    Function createStorage has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    export const createStorage = () => {
        const storage = createStore(reducers, applyMiddleware(
            thunk as ThunkMiddleware<State, AnyAction> // lets us dispatch() functions
          ));
    
    
    Severity: Minor
    Found in src/utils/storage/index.ts - About 5 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

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

        private emit(evtName: string){
            console.log(evtName);
            if(this.listeners[evtName] && this.listeners[evtName].length){
                this.listeners[evtName].forEach(listener => listener());
            }
    Severity: Major
    Found in src/models/channel.ts and 1 other location - About 5 hrs to fix
    src/models/offerings.ts on lines 104..112

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

    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

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

        private emit(evtName: string){
            console.log(evtName);
            if(this.listeners[evtName] && this.listeners[evtName].length){
                this.listeners[evtName].forEach(listener => listener());
            }
    Severity: Major
    Found in src/models/offerings.ts and 1 other location - About 5 hrs to fix
    src/models/channel.ts on lines 376..384

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

    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 index.tsx has 390 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import * as React from 'react';
    import i18n from 'i18next/init';
    
    import CopyToClipboard from 'common/copyToClipboard';
    
    
    Severity: Minor
    Found in src/common/tables/index.tsx - About 5 hrs to fix

      File index.tsx has 389 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as React from 'react';
      import { WithTranslation, withTranslation } from 'react-i18next';
      import { connect } from 'react-redux';
      import Pagination from 'react-js-pagination';
      
      
      Severity: Minor
      Found in src/client/vpn_list/list/index.tsx - About 5 hrs to fix

        Function render has 148 lines of code (exceeds 40 allowed). Consider refactoring.
        Open

            render(){
        
                const { t, offering } = this.props;
                const offeringIpType = ipTypes.filter(ipType => ipType.type === offering.ipType);
        
        
        Severity: Major
        Found in src/agent/offerings/offeringView.tsx - About 5 hrs to fix

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

                      if(mustBeNumber.length){
                          const Field = t('Field', {context: mustBeNumber.length > 1 ? 'plural' : ''});
                          const Fields = mustBeNumber.map(key => aliases[key]).join(', ');
                          const mustBe = t('MustBeNumber', {context: mustBeNumber.length > 1 ? 'plural' : ''});
                          msg += (`${Field} ${Fields} ${mustBe} ` as any).capitalize();
          Severity: Major
          Found in src/agent/offerings/createOffering/index.tsx and 5 other locations - About 5 hrs to fix
          src/agent/offerings/createOffering/index.tsx on lines 301..306
          src/agent/offerings/createOffering/index.tsx on lines 307..312
          src/agent/offerings/createOffering/index.tsx on lines 319..324
          src/agent/offerings/createOffering/index.tsx on lines 325..330
          src/agent/offerings/createOffering/index.tsx on lines 331..336

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

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

                      if(mustBeFilled.length){
                          const Field = t('Field', {context: mustBeFilled.length > 1 ? 'plural' : ''});
                          const Fields = mustBeFilled.map(key => aliases[key]).join(', ');
                          const isRequired = t('isRequired', {context: mustBeFilled.length > 1 ? 'plural' : ''});
                          msg += (`${Field} ${Fields} ${isRequired} ` as any).capitalize();
          Severity: Major
          Found in src/agent/offerings/createOffering/index.tsx and 5 other locations - About 5 hrs to fix
          src/agent/offerings/createOffering/index.tsx on lines 307..312
          src/agent/offerings/createOffering/index.tsx on lines 313..318
          src/agent/offerings/createOffering/index.tsx on lines 319..324
          src/agent/offerings/createOffering/index.tsx on lines 325..330
          src/agent/offerings/createOffering/index.tsx on lines 331..336

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

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

                      if(isZero.length){
                          const Field = t('Field', {context: isZero.length > 1 ? 'plural' : ''});
                          const Fields = isZero.map(key => aliases[key]).join(', ');
                          const haveZero = t('haveZeroValue', {context: isZero.length > 1 ? 'plural' : ''});
                          msg += (`${Field} ${Fields} ${haveZero} ` as any).capitalize();
          Severity: Major
          Found in src/agent/offerings/createOffering/index.tsx and 5 other locations - About 5 hrs to fix
          src/agent/offerings/createOffering/index.tsx on lines 301..306
          src/agent/offerings/createOffering/index.tsx on lines 307..312
          src/agent/offerings/createOffering/index.tsx on lines 313..318
          src/agent/offerings/createOffering/index.tsx on lines 325..330
          src/agent/offerings/createOffering/index.tsx on lines 331..336

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

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

                      if(mustBePositive.length){
                          const Field = t('Field', {context: mustBePositive.length > 1 ? 'plural' : ''});
                          const Fields = mustBePositive.map(key => aliases[key]).join(', ');
                          const haveNegative = t('haveNegativeValue', {context: mustBePositive.length > 1 ? 'plural' : ''});
                          msg += (`${Field} ${Fields} ${haveNegative} ` as any).capitalize();
          Severity: Major
          Found in src/agent/offerings/createOffering/index.tsx and 5 other locations - About 5 hrs to fix
          src/agent/offerings/createOffering/index.tsx on lines 301..306
          src/agent/offerings/createOffering/index.tsx on lines 307..312
          src/agent/offerings/createOffering/index.tsx on lines 313..318
          src/agent/offerings/createOffering/index.tsx on lines 319..324
          src/agent/offerings/createOffering/index.tsx on lines 331..336

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

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

                      if(emptyStrings.length){
                          const Field = t('Field', {context: emptyStrings.length > 1 ? 'plural' : ''});
                          const Fields = emptyStrings.map(key => aliases[key]).join(', ');
                          const cantBeEmpty = t('cantBeEmpty', {context: emptyStrings.length > 1 ? 'plural' : ''});
                          msg += (`${Field} ${Fields} ${cantBeEmpty} ` as any).capitalize();
          Severity: Major
          Found in src/agent/offerings/createOffering/index.tsx and 5 other locations - About 5 hrs to fix
          src/agent/offerings/createOffering/index.tsx on lines 301..306
          src/agent/offerings/createOffering/index.tsx on lines 307..312
          src/agent/offerings/createOffering/index.tsx on lines 313..318
          src/agent/offerings/createOffering/index.tsx on lines 319..324
          src/agent/offerings/createOffering/index.tsx on lines 325..330

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

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

                      if(mustBeInteger.length){
                          const Field = t('Field', {context: mustBeInteger.length > 1 ? 'plural' : ''});
                          const Fields = mustBeInteger.map(key => aliases[key]).join(', ');
                          const mustBe = t('MustBeInteger', {context: mustBeInteger.length > 1 ? 'plural' : ''});
                          msg += (`${Field} ${Fields} ${mustBe} ` as any).capitalize();
          Severity: Major
          Found in src/agent/offerings/createOffering/index.tsx and 5 other locations - About 5 hrs to fix
          src/agent/offerings/createOffering/index.tsx on lines 301..306
          src/agent/offerings/createOffering/index.tsx on lines 313..318
          src/agent/offerings/createOffering/index.tsx on lines 319..324
          src/agent/offerings/createOffering/index.tsx on lines 325..330
          src/agent/offerings/createOffering/index.tsx on lines 331..336

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

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

              render() {
          
                  const { t, account, localSettings } = this.props;
                  const { destination, address, gasPrice, transferStarted } = this.state;
          
          
          Severity: Major
          Found in src/common/accounts/accountView.tsx - About 4 hrs to fix

            Function createStorage has 135 lines of code (exceeds 40 allowed). Consider refactoring.
            Open

            export const createStorage = () => {
                const storage = createStore(reducers, applyMiddleware(
                    thunk as ThunkMiddleware<State, AnyAction> // lets us dispatch() functions
                  ));
            
            
            Severity: Major
            Found in src/utils/storage/index.ts - About 4 hrs to fix

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

                                      <li role='tab' className={ step >= 2 ? (step > 2 ? 'first done' : 'first current') : 'disabled' } style={{width:'auto'}}>
                                          <Link id='steps-uid-0-t-0' to='#'>
                                              <span className='current-info audible'>{t('currentStep')}: </span>
                                              <span className='number'>2.</span>
                                              {t('Password')}
              Severity: Major
              Found in src/common/wizard/steps.tsx and 1 other location - About 4 hrs to fix
              src/common/wizard/steps.tsx on lines 34..40

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

              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

                                      <div className='form-group row'>
                                          <label className='col-3 col-form-label'>{t('Balance')}</label>
                                          <div className='col-9'>
                                              <div className='input-group bootstrap-touchspin'>
                                                  <input type='text' className='form-control' value={prix(account.pscBalance)} readOnly/>
              Severity: Major
              Found in src/common/accounts/accountView.tsx and 2 other locations - About 4 hrs to fix
              src/common/accounts/accountView.tsx on lines 206..214
              src/client/vpn_list/acceptOffering.tsx on lines 230..238

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

              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

                                  <div className='form-group row'>
                                      <label className='col-3 col-form-label'>{t('PricePerMB')}</label>
                                      <div className='col-9'>
                                          <div className='input-group bootstrap-touchspin'>
                                              <input type='text' className='form-control' value={prix(offering.unitPrice)} readOnly/>
              Severity: Major
              Found in src/client/vpn_list/acceptOffering.tsx and 2 other locations - About 4 hrs to fix
              src/common/accounts/accountView.tsx on lines 197..205
              src/common/accounts/accountView.tsx on lines 206..214

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

              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