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
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 = () => {
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>
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>
Function Input
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const Input = props => {
const {
type,
elementType,
name,
- Read upRead up
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,
}) => {
- Read upRead up
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: {},
- Read upRead up
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: '',
- Read upRead up
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,
- Read upRead up
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: '',
Avoid too many return
statements within this function. Open
return updateState(prevState => ({
...prevState,
createAccount: false,
errors: {}
}));