| Conditions | 2 |
| Total Lines | 67 |
| Code Lines | 52 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import React, { Component } from "react" |
||
| 7 | render() { |
||
| 8 | return ( |
||
| 9 | <tr |
||
| 10 | className={ |
||
| 11 | this.props.result.team === this.props.highlight |
||
| 12 | ? "team-ranking__row--highlight team-ranking__row" |
||
| 13 | : "team-ranking__row" |
||
| 14 | } |
||
| 15 | > |
||
| 16 | <td |
||
| 17 | className={ |
||
| 18 | "team-ranking__column team-ranking__column--number team-ranking__column--ranking" |
||
| 19 | } |
||
| 20 | > |
||
| 21 | {this.props.result.position} |
||
| 22 | </td> |
||
| 23 | <td |
||
| 24 | className={`team-ranking__column team-ranking__column--string team-ranking__column--team |
||
| 25 | ${ |
||
| 26 | this.props.result.team.includes("Elewijt") && |
||
| 27 | "team-ranking__winner" |
||
| 28 | }`} |
||
| 29 | > |
||
| 30 | {this.props.result.team} |
||
| 31 | </td> |
||
| 32 | <td className={"team-ranking__column team-ranking__column--number"}> |
||
| 33 | {this.props.result.matches} |
||
| 34 | </td> |
||
| 35 | <td className={"team-ranking__column team-ranking__column--number"}> |
||
| 36 | {this.props.result.wins} |
||
| 37 | </td> |
||
| 38 | <td className={"team-ranking__column team-ranking__column--number"}> |
||
| 39 | {this.props.result.draws} |
||
| 40 | </td> |
||
| 41 | <td className={"team-ranking__column team-ranking__column--number"}> |
||
| 42 | {this.props.result.losses} |
||
| 43 | </td> |
||
| 44 | <td |
||
| 45 | className={ |
||
| 46 | "team-ranking__column team-ranking__column--number team-ranking__column--goals-pro" |
||
| 47 | } |
||
| 48 | > |
||
| 49 | {this.props.result.goalsPro} |
||
| 50 | </td> |
||
| 51 | <td |
||
| 52 | className={ |
||
| 53 | "team-ranking__column team-ranking__column--number team-ranking__column--goals-against" |
||
| 54 | } |
||
| 55 | > |
||
| 56 | {" "} |
||
| 57 | {this.props.result.goalsAgainst} |
||
| 58 | </td> |
||
| 59 | <td |
||
| 60 | className={ |
||
| 61 | "team-ranking__column team-ranking__column--number team-ranking__column--goals-difference" |
||
| 62 | } |
||
| 63 | > |
||
| 64 | {this.props.result.goalsPro - this.props.result.goalsAgainst} |
||
| 65 | </td> |
||
| 66 | <td |
||
| 67 | className={ |
||
| 68 | "team-ranking__column team-ranking__column--number team-ranking__column--points" |
||
| 69 | } |
||
| 70 | > |
||
| 71 | {this.props.result.points} |
||
| 72 | </td> |
||
| 73 | </tr> |
||
| 74 | ) |
||
| 242 |