IanGallacher/SC2-AI-Website

View on GitHub

Showing 17 of 52 total issues

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

  render() {
    const bot = this.state.bot;
    if (bot === null) {
      return <div className="trading-card-horizontal">
        <LoadingAnimation/>
Severity: Major
Found in client-src/js/endpoint/bot-profile.js - About 2 hrs to fix

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

      render() {
        let new_season_id = this.context.selected.id;
        if(this.state.old_season != new_season_id)
          this.updateResultData(new_season_id);
        let rows = this.initPageNumbers();
    Severity: Major
    Found in client-src/js/endpoint/recent-results.js - About 2 hrs to fix

      Function renderActiveShape has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const renderActiveShape = (p) => {
        const { cx, cy, midAngle, innerRadius, outerRadius, startAngle, endAngle,
          fill, payload, percent, value } = p;
        const sin = Math.sin(-RADIAN * midAngle);
        const cos = Math.cos(-RADIAN * midAngle);
      Severity: Major
      Found in client-src/js/component/chart.jsx - About 2 hrs to fix

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

          render() {
            return (
              <ModalContext.Consumer>{modal => <div className="trading-card-horizontal">
                <UserTitle user={this.state.profile}/>
                <div className="flex-horizontal">
        Severity: Minor
        Found in client-src/js/endpoint/author-profile.js - About 1 hr to fix

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

            render() {
              let headerClass = "navbar";
              headerClass += (this.state.navbarExpanded) ? " expanded" : " collapsed";
              let toggleClass = "toggle-bar";
              toggleClass += (this.state.navbarExpanded) ? " expanded" : " collapsed";
          Severity: Minor
          Found in client-src/js/component/header.jsx - About 1 hr to fix

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

              render() {
                let password_token = this.getPasswordToken();
                if(password_token != "")
                  return <form name="form-password-reset"
                    className="flex-vertical form-container"
            Severity: Minor
            Found in client-src/js/endpoint/reset-password.js - About 1 hr to fix

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

                render() {
                  return (
                    <form name="form-signup"
                      className="flex-vertical form-container"
                      onSubmit={this.onSubmit}>
              Severity: Minor
              Found in client-src/js/endpoint/sign-up.js - About 1 hr to fix

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

                  render() {
                    // If we have recieved data, filter and sort the data.
                    let bot_table = this.props.bots;
                    return <ModalContext.Consumer>{modalContext =>
                      <CustomReactTable table={bot_table} nullMessage="No bots found for user">
                Severity: Minor
                Found in client-src/js/endpoint/admin.js - About 1 hr to fix

                  Function drawPoints has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    drawPoints() {
                      if(!this.canvas) return;
                      const canvas = this.canvas;
                      canvas.width = this.state.width;
                      canvas.height = this.state.height;
                  Severity: Minor
                  Found in client-src/js/endpoint/splash-screen.js - About 1 hr to fix

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

                      render() {
                        let width = this.props.width || 200;
                        let height = this.props.height || 300;
                        let offset = -(400 - width)/2;
                        let style= { top: "-25px" };
                    Severity: Minor
                    Found in client-src/js/component/chart.jsx - About 1 hr to fix

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

                        render() {
                          const search = this.props.location.search;
                          const params = new URLSearchParams(search);
                          let entry_list = [];
                          for(let pair of params.entries()) entry_list.push(pair);
                      Severity: Minor
                      Found in client-src/js/component/filter.jsx - About 1 hr to fix

                        Method initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def initialize(user)
                            signed_in = user.present?
                            user ||= User.new
                            can :read, :all
                        
                        
                        Severity: Minor
                        Found in app/models/ability.rb - About 1 hr 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 UNSAFE_componentWillReceiveProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          UNSAFE_componentWillReceiveProps(props) {
                            // If we have not yet recieved a table, there is nothing to do.
                            if(props.table === null) return;
                            // If the prop has removed the element, update the state.
                            for(let c of this.state.table) {
                        Severity: Minor
                        Found in client-src/js/table/table.jsx - About 35 mins 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

                        Method game_result_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def game_result_params
                            p = params.permit(:map, :replayfile, :winner_id, :gba)
                            if params.key? :gba
                              p[:bot_ids] = JSON.parse(params[:gba])
                            else
                        Severity: Minor
                        Found in app/controllers/game_results_controller.rb - About 35 mins 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          render() {
                            let bot = this.props.bot;
                            let uploadPath = `/bots${bot ? `/${bot.id}` : ""}`;
                            return <FormZone uploadPath={uploadPath} method={this.props.method}>
                              <h3>{this.props.label}</h3>
                        Severity: Minor
                        Found in client-src/js/component/bot-upload.jsx - About 35 mins 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 UNSAFE_componentWillReceiveProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          UNSAFE_componentWillReceiveProps(props) {
                            // If the prop has removed the element, update the state
                            for(let message of this.state.messages) {
                              if(!props.messages.find(e => e.id === message.id))
                                this._deleteMessage(message);
                        Severity: Minor
                        Found in client-src/js/component/alert.jsx - About 25 mins 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

                        Method update_download_zip_if_necessary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def update_download_zip_if_necessary
                            Zip::File.open(bots_zip_path, Zip::File::CREATE) do |zipfile|
                              self.bots.each do |bot|
                                # Two arguments:
                                # - The name of the file as it will appear in the archive
                        Severity: Minor
                        Found in app/models/season.rb - About 25 mins 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

                        Severity
                        Category
                        Status
                        Source
                        Language