Kalkuli/2018.2-Kalkuli_Front-End

View on GitHub

Showing 102 of 102 total issues

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

export const mapDispatchToProps = dispatch => {
    return {
        onReceiptsAdded: (receipts) => {dispatch({type: actionTypes.ADD_RECEIPTS, receipts: receipts})},
        onTagsAdded: (tags) => dispatch({ type: actionTypes.ADD_TAGS, tags: tags }) 
    }
Severity: Major
Found in src/components/Reports/Reports.js and 3 other locations - About 2 hrs to fix
src/components/Dashboard/Dashboard.js on lines 334..339
src/components/Receipt/ReceiptList/List.js on lines 168..173
src/components/Receipt/ReceiptList/ReceiptList.js on lines 49..54

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

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

export const mapDispatchToProps = dispatch => {
    return {
        onReceiptsAdded: (receipts) => {dispatch({type: actionTypes.ADD_RECEIPTS, receipts: receipts})},
        onTagsAdded: (tags) => dispatch({ type: actionTypes.ADD_TAGS, tags: tags }) 
    }
Severity: Major
Found in src/components/Receipt/ReceiptList/List.js and 3 other locations - About 2 hrs to fix
src/components/Dashboard/Dashboard.js on lines 334..339
src/components/Receipt/ReceiptList/ReceiptList.js on lines 49..54
src/components/Reports/Reports.js on lines 206..211

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

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

    render() {
        return (
            <div className="reports">
                <Navbar />
                <MenuButton/>
Severity: Major
Found in src/components/Reports/Reports.js - About 2 hrs to fix

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

                <div className="feature__container__element">
                  <div className="feature__container__element__border">
                    <img className="feature__container__element__img" src={imgPiggy} alt="controle financeiro"/>
                  </div>
                  <p className="feature__container__element__p">
    Severity: Major
    Found in src/components/HomePage/HomePage.js and 3 other locations - About 2 hrs to fix
    src/components/HomePage/HomePage.js on lines 56..63
    src/components/HomePage/HomePage.js on lines 64..71
    src/components/HomePage/HomePage.js on lines 72..79

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

    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="feature__container__element">
                  <div className="feature__container__element__border">
                    <img className="feature__container__element__img" src={imgAnalysis} alt="interpreta informações"/>
                  </div>
                  <p className="feature__container__element__p">
    Severity: Major
    Found in src/components/HomePage/HomePage.js and 3 other locations - About 2 hrs to fix
    src/components/HomePage/HomePage.js on lines 48..55
    src/components/HomePage/HomePage.js on lines 56..63
    src/components/HomePage/HomePage.js on lines 64..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 78.

    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="feature__container__element">
                  <div className="feature__container__element__border">
                    <img className="feature__container__element__img" src={imgReceipt} alt="evita perda de comprovantes"/>
                  </div>
                  <p className="feature__container__element__p">
    Severity: Major
    Found in src/components/HomePage/HomePage.js and 3 other locations - About 2 hrs to fix
    src/components/HomePage/HomePage.js on lines 48..55
    src/components/HomePage/HomePage.js on lines 64..71
    src/components/HomePage/HomePage.js on lines 72..79

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

    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="feature__container__element">
                  <div className="feature__container__element__border">
                    <img className="feature__container__element__img" src={imgResult} alt="agiliza relatórios"/>
                  </div>
                  <p className="feature__container__element__p">
    Severity: Major
    Found in src/components/HomePage/HomePage.js and 3 other locations - About 2 hrs to fix
    src/components/HomePage/HomePage.js on lines 48..55
    src/components/HomePage/HomePage.js on lines 56..63
    src/components/HomePage/HomePage.js on lines 72..79

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

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

        render() {
            let done = this.editConfirmationDone()
            let error = this.editConfirmationError()
            let receiptView = null
            if (this.state.selectedReceipt) {
    Severity: Major
    Found in src/components/Receipt/ReceiptList/List.js - About 2 hrs to fix

      Function chooseContent has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const chooseContent = (props) => {
          let text = null
          let subText = null
          switch(props.reportCase){
              case 'reports':
      Severity: Minor
      Found in src/components/UI/Report/Report.js - About 1 hr to fix

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

        export default async (user) => {
          if(user.password) {
            return await new Promise(resolve => {
              resolve('success')
            })
        Severity: Major
        Found in src/services/__mocks__/logUserIn.js and 1 other location - About 1 hr to fix
        src/services/__mocks__/newTag.js on lines 1..12

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

        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 default async (tag) => {
                if(tag.category){
                    return await new Promise(resolve => {
                      resolve('success')
                    })
        Severity: Major
        Found in src/services/__mocks__/newTag.js and 1 other location - About 1 hr to fix
        src/services/__mocks__/logUserIn.js on lines 1..11

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

        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

            companyEmail: {
                name: '*Email da Empresa:',
                value: '',
                type: 'email',
                valid: false,
        Severity: Major
        Found in src/helpers/registerInputs.js and 1 other location - About 1 hr to fix
        src/helpers/registerInputs.js on lines 17..31

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

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

            render() {
                moment.locale('pt-br')
                return (
                    <div className="dashboard">
                        <Navbar/>
        Severity: Minor
        Found in src/components/Dashboard/Dashboard.js - About 1 hr to fix

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

              admEmail: {
                  name: '*Email do Administrador:',
                  value: '',
                  type: 'email',
                  valid: false,
          Severity: Major
          Found in src/helpers/registerInputs.js and 1 other location - About 1 hr to fix
          src/helpers/registerInputs.js on lines 74..88

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

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

          const Login = (props) => {
          
            if(props.registration === 'fail')
              return <Confirmation  content="Não foi possível logar, confira seus dados" 
                                    onConfirmOk={props.onConfirmOk} 
          Severity: Minor
          Found in src/components/Login/Login.js - About 1 hr to fix

            Function build has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function build(previousFileSizes) {
              console.log('Creating an optimized production build...');
            
              let compiler = webpack(config);
              return new Promise((resolve, reject) => {
            Severity: Minor
            Found in scripts/build.js - About 1 hr to fix

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

                  render(){
                      if(this.state.smallDevice){
                          let styleSidebar = ["sidebar"]
                          if(this.state.isOpen)
                              styleSidebar.push('Open')
              Severity: Minor
              Found in src/components/UI/Navbar/Navbar.js - About 1 hr to fix

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

                    render() {
                
                        let preview = null
                        if (this.props.filePDF !== null) {
                            preview = <embed className="pdf-preview" src={this.props.filePDF} type="application/pdf" width="290px" height="466px" />
                Severity: Minor
                Found in src/components/Receipt/ReceiptCompare/ReceiptCompare.js - About 1 hr to fix

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

                    cnpj: {
                      name: 'CNPJ',
                      value: '',
                      type: 'text',
                      valid: false,
                  Severity: Major
                  Found in src/helpers/receiptInputs.js and 1 other location - About 1 hr to fix
                  src/helpers/receiptInputs.js on lines 29..42

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

                  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

                    emission_date: {
                      name: 'Data',
                      value: '',
                      type: 'text',
                      valid: false,
                  Severity: Major
                  Found in src/helpers/receiptInputs.js and 1 other location - About 1 hr to fix
                  src/helpers/receiptInputs.js on lines 15..28

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

                  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