alexzherdev/foosballtracker

View on GitHub

Showing 8 of 77 total issues

Function h2h has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  let h2h = () => {
    let teamClasses = (attr, direction) => {
      let teamValue = stats.stats[attr];
      let oppValue = h2hStats.stats[attr];
      let classes;
Severity: Major
Found in src/js/components/teamStats/headToHead.js - About 3 hrs to fix

Function TeamHeadToHead has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

const TeamHeadToHead = ({stats, teams, onTeamSelect, h2hStats, h2hMatches}) => {
  const teamId = stats.team.id;

  let h2h = () => {
    let teamClasses = (attr, direction) => {
Severity: Minor
Found in src/js/components/teamStats/headToHead.js - About 2 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 _getTeamStats has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

let _getTeamStats = (teamId) => {
  let extractCurrentStreak = (form) => {
    let match = form.match(/^W+/)
    if (match) {
      return { wins: match[0].length };
Severity: Minor
Found in src/api/models/stats.js - About 1 hr to fix

Function exports has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(config) {
  config.set({
    browsers: [process.env.TRAVIS ? 'Firefox' : 'Chrome'],
    files: [
      { pattern: 'tests.webpack.js', watched: false }
Severity: Minor
Found in karma.conf.js - About 1 hr to fix

Function h2hMatchesBody has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    let h2hMatchesBody = () => {
      let body;
      if (h2hMatches.length) {
        let matches = h2hMatches;
        let won = _.filter(matches, (m) => m.team1_id === teamId ? m.team1_score > m.team2_score : m.team2_score > m.team1_score).length;
Severity: Minor
Found in src/js/components/teamStats/headToHead.js - About 1 hr to fix

Function exports has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function() {
  return Promise.map([{ name: 'Michel Platini' }, { name: 'Zinedine Zidane' }, { name: 'Gianluigi Buffon' }, { name: 'Paolo Maldini' },
    { name: 'Pele' }, { name: 'Ronaldo' }, { name: 'Franz Beckenbauer'}, { name: 'Oliver Kahn' }, { name: 'No Matches'}], (attrs) => {
    return Player.createWithEigenTeam(attrs);
  }).then((players) => {
Severity: Minor
Found in src/api/spec/support/setupMatches.js - About 1 hr to fix

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

  render() {
    const stats = this.props.stats;
    if (!stats) {
      return (<div>Loading...</div>);
    }
Severity: Minor
Found in src/js/containers/TeamStatsContainer.js - About 1 hr to fix

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

  const verifyMatch = function(match, matchType, team1, team2, winner, done) {
Severity: Minor
Found in src/api/spec/models/matchSpec.js - About 45 mins to fix
Severity
Category
Status
Source
Language