dsi-icl/optimise

View on GitHub

Showing 1,390 of 1,390 total issues

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

    static editMedicalCondition({ body, user }, res) {
        if (body.hasOwnProperty('id') && typeof body.id === 'number' &&
            ((body.hasOwnProperty('outcome') && typeof body.outcome === 'string') || !body.hasOwnProperty('outcome')) &&
            ((body.hasOwnProperty('resolvedYear') && typeof body.resolvedYear === 'number') || !body.hasOwnProperty('resolvedYear'))) {
            MedicalHistoryCore.editMedicalHistory(user, body).then((result) => {
Severity: Minor
Found in packages/optimise-core/src/controllers/demographicDataController.js - 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

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

    static createConcomitantMed({ body, user }, res) {
        if (!body.visitId
            || !body.concomitantMedId
            || !body.indication
            || !body.startDate
Severity: Minor
Found in packages/optimise-core/src/controllers/concomitantMedController.js - 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

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

    static async handleMeddraUploadByAdmin({ user, files }, res) {
        if (user.adminPriv !== 1) {
            res.status(401).json({ error: 'Not authorized.' });
            return;
        }
Severity: Minor
Found in packages/optimise-core/src/controllers/meddraController.js - 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

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

    static _formatEntries({ dataTableForeignKey, entryIdString }, { body, user }) {
        const returned = {};
        const numOfUpdates = (body.hasOwnProperty('update')) ? Object.keys(body.update).length : 0;
        const numOfAdds = (body.hasOwnProperty('add')) ? Object.keys(body.add).length : 0;
        const updates = [];
Severity: Minor
Found in packages/optimise-core/src/controllers/dataController.js - 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

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

    static editComorbidity({ body, user }, res) {

        if (body.hasOwnProperty('id') && typeof body.id === 'number') {
            const entryObj = Object.assign({}, body);
            if (typeof body.comorbidity !== 'number') {
Severity: Minor
Found in packages/optimise-core/src/controllers/comorbidityController.js - 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

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

const filterNodes = (filter, nodes) =>
    nodes.reduce((filtered, n) => {
        const { nodes: filteredChildren } = n.children ? filterNodes(filter, n.children) : { nodes: [] };
        return !(filter(n) || filteredChildren.length) ? filtered : {
            nodes: [
Severity: Minor
Found in packages/optimise-ui/src/components/treePicker/treePicker.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

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

    _handleSubmit(ev) {

        ev.preventDefault();
        if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
            return;
Severity: Minor
Found in packages/optimise-ui/src/components/medicalData/ceDataPage.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

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

    _composeSubmitBody() {
        if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
            return;

        const { references, originalValues } = this;
Severity: Minor
Found in packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.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

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

    render() {
        const { match, location } = this.props;
        const { pregnancySubStudyConsent } = this.props.data;


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 6 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const { match, location } = this.props;
        const { pregnancySubStudyConsent } = this.props.data;
        const pageNumberToElementMap = {
            0: <VisitFrontPageIntroduction match={match} location={location} />,

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 componentDidMount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    componentDidMount() {    //this basically adds the originalValues and EDSSFields
        const { visitFields, patientProfile, match } = this.props;
        const { params } = match;
        const EDSSFields = visitFields.filter(el => /^edss:(.*)/.test(el.idname));
        if (EDSSFields.length !== 9) {
Severity: Minor
Found in packages/optimise-ui/src/components/EDSScalculator/calculator.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

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

    _handleSubmit() {
        for (let each of [this.usernameRef, this.realnameRef, this.pwRef, this.pwConRef, this.emailRef]) {
            if (each.current.value === '') {
                this.setState({ error: true });
                return;
Severity: Minor
Found in packages/optimise-ui/src/components/admin/userCreatePage.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

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

    _handleSubmit() {
        try {
            if (this.syncAddress.current.value !== '')
                new URL(this.syncAddress.current.value);
        } catch (e) {
Severity: Minor
Found in packages/optimise-ui/src/components/admin/sync.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

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

    _formatRequestBody() {
        const date = this.state.startDate;
        return {
            patientId: this.props.match.params.patientId,
            data: {
Severity: Minor
Found in packages/optimise-ui/src/components/createMedicalElements/createCE.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

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

    _handleSubmit(ev) {
        ev.preventDefault();
        if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
            return;
        const { references, originalValues } = this;
Severity: Minor
Found in packages/optimise-ui/src/components/medicalData/testDataPage.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

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

    render() {
        if (!this.props.data.demographicData) {
            return null;
        }
        const { visits } = this.props.data;
Severity: Minor
Found in packages/optimise-ui/src/components/patientProfile/patientChart.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

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

function log(state = initialState.log, action) {
    let body;
    let json;
    switch (action.type) {
        case actionTypes.admin.GET_LOG_REQUEST:
Severity: Minor
Found in packages/optimise-ui/src/redux/reducers.js - 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

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

function availableFields(state = initialState.availableFields, action) {
    let newState;
    let hash;
    switch (action.type) {
        case actionTypes.availableFields.GET_CE_TYPES_SUCCESS:
Severity: Minor
Found in packages/optimise-ui/src/redux/reducers.js - 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

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

    render() {
        if (this.props.visits) {
            const params = this.props.match.params;

Severity: Minor
Found in packages/optimise-ui/src/components/createMedicalElements/createTest.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

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

    _handleSubmit(ev) {
        ev.preventDefault();
        if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
            return;
        const { references, originalValues } = this;
Severity: Minor
Found in packages/optimise-ui/src/components/medicalData/visitDataPage.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