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}>
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[]> {
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>);
Function render
has 63 lines of code (exceeds 40 allowed). Consider refactoring. Open
render(){
const {
comment,
email,
date: {
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;
- Read upRead up
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;
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
- Read upRead up
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();
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}>
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) {
- Read upRead up
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) {
- Read upRead up
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)}
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();
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;
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">
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';
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
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) {
- Read upRead up
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)) {
- Read upRead up
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=`;
- Read upRead up
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"