Kalkuli/2018.2-Kalkuli_Front-End

View on GitHub

Showing 18 of 102 total issues

File Dashboard.js has 312 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { Component } from 'react'
import './Dashboard.scss'
import Navbar from '../UI/Navbar/Navbar'
import Report from '../UI/Report/Report';
import BaseButton from '../UI/Button/BaseButton/BaseButton'
Severity: Minor
Found in src/components/Dashboard/Dashboard.js - About 3 hrs to fix

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

      render(){
        return (
          <Fragment>
            <HomeNavBar onConfirmOk={this.onConfirmOk} click={this.registerClick}/>
            {this.state.newCompany ? this.showRegister() : null}
    Severity: Major
    Found in src/components/HomePage/HomePage.js - About 2 hrs to fix

      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

        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

            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

              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

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

                          render () {
                              let styleMenuButton = ["menubutton button"]
                              this.state.rotate ? styleMenuButton.push("rotate menubutton--open") : null
                             
                              let styleOptions = ["options"]
                      Severity: Minor
                      Found in src/components/UI/Button/MenuButton/MenuButton.js - About 1 hr to fix

                        Function reducer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const reducer = (state = initialState, action) => {
                          switch(action.type) {
                            case actionTypes.ADD_PDF_FILE:
                              return {
                                ...state,
                        Severity: Minor
                        Found in src/store/reducers/reducer.js - About 1 hr to fix

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

                            render(){
                              
                              const isLoggedIn = this.props.auth_token;
                              let buttonLogIN;
                              let buttonSignUp;
                          Severity: Minor
                          Found in src/components/UI/Navbar/HomeNavBar/HomeNavBarLinks.js - About 1 hr to fix

                            Function render has a Cognitive Complexity of 8 (exceeds 5 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 45 mins to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Function chooseContent has a Cognitive Complexity of 7 (exceeds 5 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 35 mins to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

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

                            const BaseButton = (props) => {
                              
                              let styles = ["base-button"]
                              if(props.type === 'confirm')
                                styles.push('confirm')
                            Severity: Minor
                            Found in src/components/UI/Button/BaseButton/BaseButton.js - About 35 mins to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Function render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              render() {
                                let content = this.ChooseScreen()
                            
                                if(this.state.extraction)
                                  content = <ReceiptCompare selectedTag={this.state.newTag} onCancelHandler={this.onCancelHandler} onConfirmButton={this.onConfirmButton} createCategory={this.createCategory} manual backDropDown={this.jumpExtraction}/>
                            Severity: Minor
                            Found in src/components/Receipt/ReceiptAdder/ReceiptAdder.js - About 25 mins to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Function Input has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const Input = (props) => {
                            
                              let styles = ["input-area__input"]
                              if(props.editable && props.valid)
                                styles.push("input-area__input--valid")
                            Severity: Minor
                            Found in src/components/UI/Input/Input.js - About 25 mins to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Severity
                            Category
                            Status
                            Source
                            Language