rugby-board/rugby-board-node

View on GitHub

Showing 32 of 32 total issues

Function handleFormat has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  handleFormat() {
    const input = this.state.inputResult;
    const lines = input.split('\n');
    const teams = [];
    let formatted = '| 主队 | 比分 | 客队 |\n|----|----|----|\n';
Severity: Minor
Found in client/components/admin/PlanetRugbyResult.jsx - 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 contentWithColumns has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    const contentWithColumns = columnArray.map((index) => {
      const columns = [index * 2, (index * 2) + 1].map((contentIndex) => {
        const section = this.contentList[contentIndex];
        if (section !== undefined) {
          const sectionHeading = {
Severity: Minor
Found in client/pages/InfoPage.jsx - About 1 hr to fix

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

      handleFormat() {
        const input = this.state.inputResult;
        const lines = input.split('\n');
        const teams = [];
        let formatted = '| 主队 | 比分 | 客队 |\n|----|----|----|\n';
    Severity: Minor
    Found in client/components/admin/PlanetRugbyResult.jsx - About 1 hr to fix

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

        render() {
          let link = this.props.data.more_text;
          if (this.props.data.more_text && this.props.data.more_link) {
            if (this.props.data.use_router === 0) {
              link = (
      Severity: Minor
      Found in client/components/Heading.jsx - About 1 hr to fix

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

          render() {
            return (
              <div className="news">
                <div className="news-wrap" id="rugby-championship">
                  <div className="news-item">
        Severity: Minor
        Found in client/components/wiki/RugbyChampionship.jsx - About 1 hr to fix

          Function columns has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                const columns = [index * 2, (index * 2) + 1].map((contentIndex) => {
                  const section = this.contentList[contentIndex];
                  if (section !== undefined) {
                    const sectionHeading = {
                      id: section.id,
          Severity: Minor
          Found in client/pages/InfoPage.jsx - About 1 hr to fix

            Function handleSubmit has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              handleSubmit() {
                const newsForm = {
                  title: this.state.news.title,
                  content: this.state.news.content,
                  channel: this.state.news.channel,
            Severity: Minor
            Found in client/components/admin/Create.jsx - About 1 hr to fix

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

                constructor(props) {
                  super(props);
              
                  const newsHeading = {
                    id: 'latest-news',
              Severity: Minor
              Found in client/pages/HomePage.jsx - About 1 hr to fix

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

                  render() {
                    return (
                      <div className="news" id="format-result">
                        <div className="news-wrap">
                          <div className="news-item">
                Severity: Minor
                Found in client/components/admin/ToolBox.jsx - About 1 hr to fix

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

                    constructor(props) {
                      super(props);
                  
                      const searchHeading = {
                        id: 'news',
                  Severity: Minor
                  Found in client/pages/SearchPage.jsx - About 1 hr to fix

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

                    export function searchNews(title, content, channel, event, page, callback, timeout) {
                    Severity: Major
                    Found in client/data.js - About 50 mins to fix

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

                        render() {
                          let link = this.props.data.more_text;
                          if (this.props.data.more_text && this.props.data.more_link) {
                            if (this.props.data.use_router === 0) {
                              link = (
                      Severity: Minor
                      Found in client/components/Heading.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

                      Severity
                      Category
                      Status
                      Source
                      Language