dbmedialab/reader-critics

View on GitHub

Showing 22 of 66 total issues

Function render has 99 lines of code (exceeds 40 allowed). Consider refactoring.
Open

    render(): JSX.Element {
        const roles = this.makeRolesOptions();
        const isDisabled = this.isFormValid();
        return (
            <ReactModal isOpen={this.props.isOpen} name="newUser" closeHandler={this.closePopup}>
Severity: Major
Found in src/admin/components/modal/AddUserModalComponent.tsx - About 3 hrs to fix

    Function default has 65 lines of code (exceeds 40 allowed). Consider refactoring.
    Open

    export default function(skip: number = defaultSkip,
                            limit: number = defaultLimit,
                            sort: Object = defaultSort,
                            search?: string
    ): Promise <ArticleDocument[]> {
    Severity: Major
    Found in src/app/services/article/common/getRangeWithFBCount.ts - About 2 hrs to fix

      Function render has 65 lines of code (exceeds 40 allowed). Consider refactoring.
      Open

          render (): JSX.Element {
              const {isOpen, name, ID, feedbackPage, feedbackNotificationMail} = this.props;
              const isDisabled = name && !ID;
      
              const captionAdd = (<div className="caption" key="add-website"><b>Add New Website</b></div>);
      Severity: Major
      Found in src/admin/components/modal/WebsiteModalComponent.tsx - About 2 hrs to fix

        Function render has 63 lines of code (exceeds 40 allowed). Consider refactoring.
        Open

            render(){
                const {
                    comment,
                    email,
                    date: {
        Severity: Major
        Found in src/admin/components/suggestions/SuggestionsListItemComponent.tsx - About 1 hr to fix

          Function filter has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
          Open

          function filter(from : any) : any {
              const to = Object.create(null);
              // Array map function, see below
              const arrayFilter = item => isPlainObject(item) ? filter(item) : item;
          
          
          Severity: Minor
          Found in src/app/db/filter.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 default has 52 lines of code (exceeds 40 allowed). Consider refactoring.
          Open

          export default function(requ : Request, resp : Response) : void {
              let articleURL : ArticleURL;
              let website : Website;
              let article : Article;
          
          
          Severity: Major
          Found in src/app/routes/api/articleHandler.ts - About 1 hr to fix

            Function diffPreParse has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
            Open

            function diffPreParse(o : string[], n : string[]) : DiffResultObject {
                const ns : DiffParsingObject = {};  // Info for new string
                const os : DiffParsingObject = {};  // Info for old string
                const nn : any[] = Object.assign([], n);  // Object to change while parsing new string
                const no : any[] = Object.assign([], o);  // Object to change while parsing old string
            Severity: Minor
            Found in src/base/diff/diffString.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 render has 50 lines of code (exceeds 40 allowed). Consider refactoring.
            Open

                render(){
                    const {feedback} = this.props;
                    const feedbackDateTimeObj = new Date(feedback.date.created);
                    const    feedbackDateTime = feedbackDateTimeObj.toLocaleDateString() + ' '
                                + feedbackDateTimeObj.toLocaleTimeString();
            Severity: Minor
            Found in src/admin/components/feedbacks/FeedbackItemComponent.tsx - About 1 hr to fix

              Function render has 50 lines of code (exceeds 40 allowed). Consider refactoring.
              Open

                  render() : JSX.Element {
                      const promptClassName =
                      this.props.promptInput.touched && this.props.promptInput.valid.isError ?'is-invalid-input':'';
                      return (
                          <ReactModal isOpen={this.props.isOpen} name="newComic" closeHandler={this.closePopup}>
              Severity: Minor
              Found in src/admin/components/modal/PromptModalComponent.tsx - About 1 hr to fix

                Function setAdditionalButtons has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
                Open

                    private setAdditionalButtons(preparedLink: string, pages: any[]) {
                        let {current} = this.props;
                        const {total} = this.props;
                
                        if (total <= current) {
                Severity: Minor
                Found in src/admin/components/layout/PaginationPanel.tsx - 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 setAdditionalButtons has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
                Open

                    private setAdditionalButtons(preparedLink: string, pages: any[]) {
                        let {current} = this.props;
                        const {total} = this.props;
                
                        if (total <= current) {
                Severity: Minor
                Found in src/admin/components/layout/Pagination.tsx - 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 43 lines of code (exceeds 40 allowed). Consider refactoring.
                Open

                    public render() {
                        return <form>
                            <fieldset className="text">
                                <textarea
                                    onKeyUp={() => this.UpdateState('text', this.textArea)}
                Severity: Minor
                Found in src/front/component/ArticleEditForm.tsx - About 1 hr to fix

                  Function render has 43 lines of code (exceeds 40 allowed). Consider refactoring.
                  Open

                      render() {
                          const {feedback} = this.props;
                          const feedbackDateTimeObj = new Date(feedback.date.created);
                          const feedbackDateTime = feedbackDateTimeObj.toLocaleDateString() + ' '
                              + feedbackDateTimeObj.toLocaleTimeString();
                  Severity: Minor
                  Found in src/admin/components/article/ArticleFeedbackItemComponent.tsx - About 1 hr to fix

                    Function render has 43 lines of code (exceeds 40 allowed). Consider refactoring.
                    Open

                        render () {
                            const gridArticles = this.generateGridData();
                            const {page, limit} = this.state;
                            const {pageCount} = this.props;
                    
                    
                    Severity: Minor
                    Found in src/admin/components/articles/ArticlesGriddle.tsx - About 1 hr to fix

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

                          render(): JSX.Element {
                              return (
                                  <ReactModal isOpen={this.props.isOpen} name="loginUser" closeHandler={() => {}}>
                                      <div className="modal-window">
                                          <div className="row">
                      Severity: Minor
                      Found in src/admin/components/modal/LoginModalComponent.tsx - About 1 hr to fix

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

                            render(): JSX.Element {
                                const userName = this.props.currentUser.name;
                                let submenuClass = 'top-bar-left show-for-small-only';
                                submenuClass += (this.props.isSubmenuOpen)?' open':'';
                                let accountMenuClass:string = 'has-dropdown bg-white';
                        Severity: Minor
                        Found in src/admin/components/layout/TopbarComponent.tsx - About 1 hr to fix

                          Function diffPreParse has 41 lines of code (exceeds 40 allowed). Consider refactoring.
                          Open

                          function diffPreParse(o : string[], n : string[]) : DiffResultObject {
                              const ns : DiffParsingObject = {};  // Info for new string
                              const os : DiffParsingObject = {};  // Info for old string
                              const nn : any[] = Object.assign([], n);  // Object to change while parsing new string
                              const no : any[] = Object.assign([], o);  // Object to change while parsing old string
                          Severity: Minor
                          Found in src/base/diff/diffString.ts - About 1 hr to fix

                            Function iterateParsedElements has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                            Open

                                private iterateParsedElements() : void {
                            
                                    while (this.parsedItems.length > 0) {
                                        const item = this.parsedItems.shift();
                                        for (const key in ArticleItemType) {
                            Severity: Minor
                            Found in src/app/parser/AbstractIteratingParser.ts - About 55 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 translate has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
                            Open

                            export function translate(id : string, options? : string|TranslateOptions) : string {
                                let usedLocale;
                            
                                // A single string value in "options" means to override the system default locale
                                if (isString(options)) {
                            Severity: Minor
                            Found in src/app/services/localization/index.ts - 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 preparePagination has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                            Open

                                preparePagination() {
                                    let {current} = this.props;
                                    const {total, link} = this.props;
                                    const pages = [];
                                    const preparedLink = ~link.indexOf('?') ? `${link}&page=` : `${link}?page=`;
                            Severity: Minor
                            Found in src/admin/components/layout/PaginationPanel.tsx - 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