tieme-ndo/frontend

View on GitHub

Showing 31 of 50 total issues

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

  const formHandler = e => {
    e.preventDefault();
    let formData = {};
    const newState = JSON.parse(JSON.stringify(state));
    // eslint-disable-next-line no-unused-vars
Severity: Minor
Found in src/components/pages/AddFarmer/AddFarmer.js - About 1 hr to fix

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

    function registerValidSW(swUrl, config) {
      navigator.serviceWorker
        .register(swUrl)
        .then(registration => {
          registration.onupdatefound = () => {
    Severity: Minor
    Found in src/utils/serviceWorker.js - About 1 hr to fix

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

      export default function FamilyTab(props) {
        const data = props.farmer.familyInfo;
      
        return (
          <Grid data-testid="family-tab-render-test" columns={2} stackable>
      Severity: Minor
      Found in src/components/pages/DisplayFarmer/FamilyTab.js - About 1 hr to fix

        Function FarmTab has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function FarmTab(props) {
          const data = props.farmer.farmInfo;
        
          return (
            <Grid columns={2} stackable>
        Severity: Minor
        Found in src/components/pages/DisplayFarmer/FarmTab.js - About 1 hr to fix

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

          const Input = props => {
            const {
              type,
              elementType,
              name,
          Severity: Minor
          Found in src/components/common/Input/Input.js - About 55 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 PageHeader has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          const PageHeader = ({
            logOut,
            user,
            edits,
          }) => {
          Severity: Minor
          Found in src/components/common/PageHeader/PageHeader.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 Login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function Login({ setUser, ...props }) {
            const [state, updateState] = useState({
              username: '',
              password: '',
              errors: {},
          Severity: Minor
          Found in src/components/pages/Login/Login.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 PasswordReset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const PasswordReset = ({ history }) => {
            const [state, updateState] = useState({
              currentPassword: '',
              newPassword: '',
              confirmNewPassword: '',
          Severity: Minor
          Found in src/components/pages/PasswordReset/PasswordReset.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 App has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          function App() {
            const [user, setUser] = useState(undefined);
            const [data, setData] = useState({
              farmers: undefined,
              farmersDashboard: undefined,
          Severity: Minor
          Found in src/components/App/App.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

          Avoid too many return statements within this function.
          Open

                  return updateState(prevState => ({
                    ...prevState,
                    username: '',
                    password: '',
                    confirmPassword: '',
          Severity: Major
          Found in src/components/pages/AddStaff/AddStaff.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return updateState(prevState => ({
                      ...prevState,
                      createAccount: false,
                      errors: {}
                    }));
            Severity: Major
            Found in src/components/pages/AddStaff/AddStaff.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language