Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address maintainability issues (technical debt) #36

Open
4 tasks
nicholaschiang opened this issue May 17, 2021 · 0 comments
Open
4 tasks

Address maintainability issues (technical debt) #36

nicholaschiang opened this issue May 17, 2021 · 0 comments
Assignees
Labels
p4 Low priority tasks

Comments

@nicholaschiang
Copy link
Owner

I should address the maintainability issues (i.e. technical debt) brought up by CodeClimate:

  • Create a reusable API request method checker, so that I can use:
  if (isValidMethod('GET', req.method, res)) // do stuff

Instead of:

  if (req.method !== 'GET') {
    res.setHeader('Allow', ['GET']);
    res.status(405).end(`Method ${req.method as string} Not Allowed`);
  } else {
    // do stuff
  }
  • Refactor the isModelJSON() methods to throw errors instead of return.
  • Create a reusable useNProgress(isLoading: boolean) hook so I can use:
  useNProgress(loading, setError);

Instead of:

  useEffect(() => {
    if (!loading) {
      NProgress.done();
    } else {
      NProgress.start();
      setError('');
    }
  }, [loading]);
  • Refactor for "cognitive complexity" (various functions).
@nicholaschiang nicholaschiang added the p4 Low priority tasks label May 17, 2021
@nicholaschiang nicholaschiang self-assigned this May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p4 Low priority tasks
Projects
None yet
Development

No branches or pull requests

1 participant