spolnik/JAlgoArena-UI

View on GitHub

Showing 31 of 386 total issues

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

export const RegionRankingTable = (props: RegionRankingTableProps) => {
let regions = _.groupBy(props.ranking, 'region');
let regionsRank = _.orderBy(_.map(regions, (rankNodes, region) => {
return {region: region, score: _.sumBy(rankNodes, 'score'), size: rankNodes.length};
}), ['score'], ['desc']);
Severity: Minor
Found in src/client/ranking/components/RegionRankingTable.tsx - About 1 hr to fix

    Function findErrorsInSignupForm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    static findErrorsInSignupForm(formData: SignupForm, emailRegex: string, emailErrorMessage: string) {
     
    let newState = Object.assign({}, initialFormState);
     
    if (formData.username === "") {
    Severity: Minor
    Found in src/client/users/pages/signup.tsx - About 1 hr to fix

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

    export function attemptLogin(username: string, password: string) {
    const body = {
    username: username,
    password: password,
    };
    Severity: Minor
    Found in src/client/users/actions/index.ts - About 1 hr to fix

      Function attemptSignUp has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      email: string,
      password: string,
      username: string,
      region: string,
      team: string,
      Severity: Major
      Found in src/client/users/actions/index.ts - About 50 mins to fix

        Function ProblemDetails has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        const ProblemDetails = (props: ProblemProps) => {
         
        const checkControl = props.isSuccess
        ? <FontAwesome prefix="fas" name="check"/>
        : props.isFailure
        Severity: Minor
        Found in src/client/problems/components/ProblemDetails.tsx - About 35 mins to fix

        Avoid too many return statements within this function.
        Open

        return 'color-github-4';
        Severity: Major
        Found in src/client/users/components/UserStats.tsx - About 30 mins to fix

          Function render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          render() {
          let regions = this.props.config.regions;
          let teams = this.props.config.teams;
           
          let regionOptions = regions.map(region => <option>{region}</option>);
          Severity: Minor
          Found in src/client/users/pages/signup.tsx - About 25 mins to fix

          Function render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          render() {
          const {
          problems,
          problemsFilter,
          submissions,
          Severity: Minor
          Found in src/client/problems/pages/problems.tsx - About 25 mins to fix

          Function ProblemTitle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          const ProblemTitle = (props: ProblemTitleProps) => {
          let acceptedSubmissions = props.submissions.filter(
          (submission: Submission) => submission.statusCode === 'ACCEPTED'
          );
          let failedSubmissions = props.submissions.filter(
          Severity: Minor
          Found in src/client/problems/components/ProblemTitle.tsx - About 25 mins to fix

          Function componentDidUpdate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          componentDidUpdate() {
          if (this.props.auth.error === 'User name is already used') {
          if(!this.state.isUserNameFieldIncorrect){
          let newState = Object.assign({}, this.state, {isUserNameFieldIncorrect: true});
          this.setState(newState);
          Severity: Minor
          Found in src/client/users/pages/signup.tsx - About 25 mins to fix

          Function componentDidMount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          componentDidMount() {
          let problemId = this.props.match.params.id;
           
          if (store.getState().currentProblemId !== problemId) {
          store.dispatch(setCurrentProblem(problemId));
          Severity: Minor
          Found in src/client/problems/pages/problem.tsx - About 25 mins to fix
          Severity
          Category
          Status
          Source
          Language