plouc/mozaik

View on GitHub

Showing 31 of 129 total issues

Function connect has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const connect = configuration => {
    const wsUrl = guessWSURL(configuration)
    let reconnectionAttempts =
        'reconnectionAttempts' in configuration
            ? configuration.reconnectionAttempts
Severity: Major
Found in packages/ui/src/actions/wsActions.js - About 3 hrs to fix

    Function subscribe has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public subscribe(clientId: string, subscription: Subscription) {
            if (!this.clients[clientId]) {
                this.logger.error(`Unable to find a client with id '${clientId}'`)
                return
            }
    Severity: Major
    Found in packages/server/src/bus.ts - About 2 hrs to fix

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

          render() {
              const {
                  dashboard: { columns, rows, widgets: _widgets },
                  dashboardIndex,
                  registry,
      Severity: Major
      Found in packages/ui/src/components/dashboard/Dashboard.js - About 2 hrs to fix

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

            render() {
                const { apiData } = this.props
        
                const items = []
        
        
        Severity: Major
        Found in packages/ui/src/components/Inspector.js - About 2 hrs to fix

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

          const createBlogPages = (graphql, createPage, createRedirect) => {
              const query = `{
                  posts: allMarkdownRemark(
                      filter: {
                          fileAbsolutePath: { regex: "//posts/" }
          Severity: Major
          Found in website/gatsby-node.js - About 2 hrs to fix

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

                render() {
                    const { themes, currentTheme, setTheme, opened, close } = this.props
            
                    const settings = []
                    if (opened) {
            Severity: Major
            Found in packages/ui/src/components/settings/Settings.js - About 2 hrs to fix

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

                  render() {
                      const {
                          isLoading,
                          dashboards,
                          currentDashboard,
              Severity: Minor
              Found in packages/ui/src/components/Mozaik.js - About 1 hr to fix

                Function start has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public start(existingApp?: Express) {
                        if (!this.configuration) {
                            this.logger.error(
                                chalk.red(
                                    `no configuration, you must either call 'configure()' or 'configureFromFile()' before starting Mozaïk server`
                Severity: Minor
                Found in packages/server/src/mozaik.ts - About 1 hr to fix

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

                      render() {
                          const {
                              dashboards,
                              currentDashboardIndex,
                              isPlaying,
                  Severity: Minor
                  Found in packages/ui/src/components/dashboard/DashboardHeader.js - About 1 hr to fix

                    Function DocumentationPage has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const DocumentationPage = props => {
                        const {
                            data: {
                                markdownRemark: {
                                    frontmatter,
                    Severity: Minor
                    Found in website/src/templates/documentation.js - About 1 hr to fix

                      Function PostPage has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const PostPage = props => {
                          const {
                              data: {
                                  markdownRemark: {
                                      frontmatter,
                      Severity: Minor
                      Found in website/src/templates/post.js - About 1 hr to fix

                        Function notify has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const notify = notification => {
                            return (dispatch, getState) => {
                                const {
                                    notifications: { items },
                                } = getState()
                        Severity: Minor
                        Found in packages/ui/src/actions/notificationsActions.js - 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 subscribe has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public subscribe(clientId: string, subscription: Subscription) {
                                if (!this.clients[clientId]) {
                                    this.logger.error(`Unable to find a client with id '${clientId}'`)
                                    return
                                }
                        Severity: Minor
                        Found in packages/server/src/bus.ts - 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 configuration has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function configuration(state = defaultState, action) {
                            switch (action.type) {
                                case API_SUBSCRIBE:
                                    if (state.get('subscriptions').has(action.subscription.id)) {
                                        return state
                        Severity: Minor
                        Found in packages/ui/src/reducers/apiReducer.js - About 1 hr to fix

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

                              render() {
                                  const {
                                      dashboards,
                                      currentDashboardIndex,
                                      isPlaying,
                          Severity: Minor
                          Found in packages/ui/src/components/dashboard/DashboardPlayer.js - About 1 hr to fix

                            Function createDocumentationPages has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const createDocumentationPages = (graphql, createPage) => {
                                const query = `{
                                    allMarkdownRemark(filter: {
                                        fileAbsolutePath: {
                                            regex: "//docs/"
                            Severity: Minor
                            Found in website/gatsby-node.js - About 1 hr to fix

                              Function setDashboards has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const setDashboards = dashboards => {
                                  return (dispatch, getState) => {
                                      const { api } = getState()
                              
                                      const currentSubscriptionsIds = api
                              Severity: Minor
                              Found in packages/ui/src/actions/dashboardsActions.js - About 1 hr to fix

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

                                    render() {
                                        const { currentDashboardIndex, title } = this.props
                                
                                        const items = [{ key: currentDashboardIndex, title }]
                                
                                
                                Severity: Minor
                                Found in packages/ui/src/components/dashboard/DashboardTitle.js - About 1 hr to fix

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

                                  export const fetchConfiguration = () => {
                                      return dispatch => {
                                          dispatch({ type: FETCH_CONFIGURATION })
                                  
                                          return fetch('/config')
                                  Severity: Minor
                                  Found in packages/ui/src/actions/configurationActions.js - About 1 hr to fix

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

                                        render() {
                                            const { title, subject, subjectPlacement, count, icon: _icon, style, theme } = this.props
                                    
                                            let subjectNode = null
                                            if (subject) {
                                    Severity: Minor
                                    Found in packages/ui/src/components/widget/WidgetHeader.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language