commitsto/commits.to

View on GitHub

Showing 6 of 55 total issues

Function credit has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

export default function credit(t) {
  return t <= 0   ? 1 : // not late at all or early => full credit
         t < 60   ? hscale(hSecs, t, 0,    60,     1,     cSecs) :
         t < 3600 ? hscale(hMins, t, 60,   3600,   cSecs, cMins) :
         t < SID  ? hscale(hHrs,  t, 3600, SID,    cMins, cHrs)  :
Severity: Minor
Found in lib/latepenalty.js - About 4 hrs 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 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public render() {
    const { handleDelete, handleSubmit, validateFields } = this;
    const { promise: { user = {}, ...promise } = {} } = this.state;

    return (
Severity: Major
Found in client/src/views/edit.tsx - About 2 hrs to fix

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

      public render() {
        const { promises, stats: { counted = 0, pending = 0, reliability = 0 } = {} } = this.state;
        const { domain: { subdomain: username = '' } = {} } = this.props;
    
        return (
    Severity: Minor
    Found in client/src/views/user.tsx - About 1 hr to fix

      Function componentDidMount has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public componentDidMount() {
          const {
            domain: { subdomain: username = '' } = {},
            location: { pathname: urtext = '' } = {}
          } = this.props;
      Severity: Minor
      Found in client/src/components/confirm.tsx - About 1 hr to fix

        Function hscale has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        const hscale = function(h, x, a, b, u, v) {
        Severity: Minor
        Found in lib/latepenalty.js - About 45 mins to fix

          Function escale has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          const escale = function(x, a, b, u, v) {
          Severity: Minor
          Found in lib/latepenalty.js - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language