webcom-components/visio-sample

View on GitHub

Showing 25 of 83 total issues

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

    render() {
        const connectedUsers = this.props.users.filter(p => p.status === 'CONNECTED' && p.uid !== this.props.current);
        const usersList = !connectedUsers.length ? (<div>No participants registered</div>) : (
            <ListGroup
                style={{maxHeight:'288px', overflow:'auto'}}>
Severity: Major
Found in src/js/components/Users.js - About 3 hrs to fix

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

        render() {
            let audioIcon = 'mic_on', videoIcon = 'videocam';
            if (this.props.stream && this.props.stream.muted) {
                audioIcon = this.props.stream.muted.audio ? 'mic_off' : 'mic_on';
                videoIcon = this.props.stream.muted.video ? 'videocam_off' : 'videocam';
    Severity: Major
    Found in src/js/components/CmdButtons.js - About 2 hrs to fix

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

          render() {
              const { fields : { email, password, username } } = this.props;
              // ReduxFrom field props unknown to FormControl (causes warning since React 0.15.2)
              const unknownProps = [
                  'initialValue', 'autofill', 'onUpdate', 'valid', 'invalid',
      Severity: Minor
      Found in src/js/components/LoginForm.js - About 1 hr to fix

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

        export default function users(state = initialState, action = {}) {
            const _updateUser = () => state.map(p => p.uid === action.data.uid ? Object.assign({}, p, { ...action.data }) : p);
        
            switch (action.type) {
                case ADD_USER:
        Severity: Minor
        Found in src/js/reducers/users.js - About 1 hr to fix

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

          const listen = room => (dispatch, getState) => {
              const _room = rooms.find(room);
              if(_room) {
                  _room.on(Reach.events.room.STREAM_PUBLISHED, remoteStream => {
                      streams.add(remoteStream);
          Severity: Minor
          Found in src/js/actions/stream.js - About 1 hr to fix

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

                render() {
                    const size = !this.props.room.focus || this.props.room.focus === 'localVideo' ? 'big' : 'small';
                    return (
                        <div>
                            {this.props.children &&
            Severity: Minor
            Found in src/js/containers/VisioPage.js - About 1 hr to fix

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

              const listenToJoinAndLeave = room => (dispatch, getState) => {
                  rooms.find(room).on(Reach.events.room.PARTICIPANT_ADDED, p => {
                      const user = getState().users.find(u => u.uid === p.uid);
                      dispatch({
                          type: PARTICIPANT_JOIN,
              Severity: Minor
              Found in src/js/actions/room.js - About 1 hr to fix

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

                const _onceLogged = (dispatch, getState) => currentUser => {
                    history.push('/users');
                
                    dispatch({
                        type: LOGGED,
                Severity: Minor
                Found in src/js/actions/user.js - About 1 hr to fix

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

                  export const ref = () => {
                      if(!_reach) {
                          const
                              logLevel = __DEVTOOLS__ ? 'INFO' : 'ERROR',
                              preferredAudioCodec = Reach.codecs.audio.OPUS,
                  Severity: Minor
                  Found in src/js/utils/reach.js - About 1 hr to fix

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

                    const send = (invitee, room) => {
                        return (dispatch, getState) => {
                            Promise.resolve(rooms.find(room))
                                .then(_room => {
                                    if(!_room) {
                    Severity: Minor
                    Found in src/js/actions/invite.js - About 1 hr to fix

                      Function toggleFullscreen has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const toggleFullscreen = () => {
                          if (!document.fullscreenElement &&    // alternative standard method
                              !document.mozFullScreenElement && !document.webkitFullscreenElement) {  // current working methods
                              if (document.documentElement.requestFullscreen) {
                                  document.documentElement.requestFullscreen();
                      Severity: Minor
                      Found in src/js/utils/index.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 render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          render() {
                              const showModal = this.state && this.state.showModal;
                              const _inRoom = p => this.props.room.participants.find(u => u.uid === p.uid && u.status === 'CONNECTED');
                              const list = this.props.users.filter(p => p.status === 'CONNECTED' && !_inRoom(p));
                              const modalContent = !list.length ? (<div>No participants registered</div>) : (
                      Severity: Minor
                      Found in src/js/components/AddPopin.js - About 1 hr to fix

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

                        const leave = (user, room, newRoom) => dispatch => {
                            const _room = rooms.find(room);
                            _room.remoteStreams()
                                .then(remoteStreams => {
                                    remoteStreams.forEach(remoteStream => {
                        Severity: Minor
                        Found in src/js/actions/room.js - About 1 hr to fix

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

                              render() {
                                  const showModal = this.state && this.state.showModal;
                                  const { fields : { roomName } } = this.props;
                                  // ReduxFrom field props unknown to FormControl (causes warning since React 0.15.2)
                                  const unknownProps = [
                          Severity: Minor
                          Found in src/js/components/CreatePopin.js - About 1 hr to fix

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

                            export default function user(state = initialState, action = {}) {
                                switch (action.type) {
                                    case LOGGED:
                                        return {
                                            ...initialState,
                            Severity: Minor
                            Found in src/js/reducers/current.js - About 1 hr to fix

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

                                  render() {
                                      const { fields : { message } } = this.props;
                                      const unknownProps = [
                                          'initialValue', 'autofill', 'onUpdate', 'valid', 'invalid',
                                          'dirty', 'pristine', 'active', 'touched', 'visited', 'autofilled'
                              Severity: Minor
                              Found in src/js/components/Chat.js - About 1 hr to fix

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

                                export default function configureStore(reduxRouterMiddleware, initialState) {
                                    let createStoreWithMiddleware;
                                
                                    if (typeof __DEVTOOLS__ !== 'undefined' && __DEVTOOLS__) {
                                        const DevTools = require('../containers/DevTools');
                                Severity: Minor
                                Found in src/js/store/configureStore.js - About 1 hr to fix

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

                                  const answered = (accept, invitee, info) => {
                                      return (dispatch, getState) => {
                                          rooms.add(info.room);
                                  
                                          if(accept && invitee.uid === getState().current.uid) {
                                  Severity: Minor
                                  Found in src/js/actions/invite.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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      render() {
                                          let audioIcon = 'mic_on', videoIcon = 'videocam';
                                          if (this.props.stream && this.props.stream.muted) {
                                              audioIcon = this.props.stream.muted.audio ? 'mic_off' : 'mic_on';
                                              videoIcon = this.props.stream.muted.video ? 'videocam_off' : 'videocam';
                                  Severity: Minor
                                  Found in src/js/components/CmdButtons.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 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const subscribe = (remoteStream, videoTab) => (dispatch, getState) => {
                                      if (getState().room.participants.find(u => u.subscribed && u.stream && u.stream.uid === remoteStream.uid )) {
                                          return;
                                      }
                                      const _stream = streams.find(remoteStream);
                                  Severity: Minor
                                  Found in src/js/actions/stream.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language