namchey/linkpreview

View on GitHub

Showing 91 of 91 total issues

Avoid too many return statements within this function.
Open

    return res.status(err.statusCode).sendMessage(err.message);
Severity: Major
Found in modules/application/controllers/errors.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return res.status(400).sendMessage(`validation.failed.${firstValidationField}`);
    Severity: Major
    Found in modules/application/controllers/errors.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return res.status(404).sendMessage('not_found');
      Severity: Major
      Found in modules/application/controllers/errors.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return res.status(400).sendMessage('cast_error', null,
              {
                model: err.model.modelName,
                stringValue: err.stringValue,
                kind: err.kind,
        Severity: Major
        Found in modules/application/controllers/errors.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return res.status(404).sendMessage(err.message || 'not_found');
          Severity: Major
          Found in modules/application/controllers/errors.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return res.status(500).sendMessage('internal_server_error');
            Severity: Major
            Found in modules/application/controllers/errors.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return res.send(oembedXml);
              Severity: Major
              Found in modules/application/controllers/oembed.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return res.status(400).sendMessage(err.message || 'not_found');
                Severity: Major
                Found in modules/application/controllers/errors.js - About 30 mins to fix

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

                  exports.logBrowserError = (body = {}, req) => {
                    if (config.isProd) {
                      const fileLogContents = { ...body };
                  
                      //delete screenshot field for loggin in file
                  Severity: Minor
                  Found in modules/application/controllers/errors.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 hanldeCallback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const hanldeCallback = (req, res) => (err, json, body) => {  
                    if(err) {
                      return res.status(500).json(err);
                    }
                  
                  
                  Severity: Minor
                  Found in modules/scrape/v1/controllers/index.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 Message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const Message = ({message, error, normal, warning, isFixed, className, removable, dispatch, action}) => {
                  
                    const closeButton = removable && <span className={cx('btn-close', 'pull-right')} onClick = {(e) => {dispatch(action())}}>X</span>;
                  
                    return (
                  Severity: Minor
                  Found in app/components/Message/index.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

                  Severity
                  Category
                  Status
                  Source
                  Language