Showing 36 of 186 total issues
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div className="redoc page">
<Helmet
meta={[
Function scrollToElement
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
scrollToElement() {
if (Meteor.isClient) {
if (window.location.hash) {
const hashParts = window.location.hash.split("#");
- 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 renderContent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderContent() {
if (Meteor.isClient && DocSearch.getCurrentQuery()) {
if (DocSearch.getCurrentQuery().length > 0) {
return (
<SearchResults
Function constructor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
constructor(props) {
super(props);
this.displayName = "Search Field";
this.state = {
showClearButton: false
- 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 replaceLink
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
replaceLink: (link, env) => {
const isImage = link.search(/([a-z\-_0-9\/\:\.]*\.(jpg|jpeg|png|gif))/i) > -1;
const hasProtocol = link.search(/^http[s]?\:\/\//) > -1;
let newLink = link;
if (isImage && !hasProtocol) {
- 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
Avoid deeply nested control flow statements. Open
if (toc) {
if (Array.isArray(toc.tocData)) {
// Loop through all entries and add them to the TOC collection
toc.tocData.forEach((tocItem, index) => {
const filename = tocItem.docPath.split("/").pop().replace(/\.[^/.]+$/, "");
Avoid deeply nested control flow statements. Open
if (_.isFunction(md.options.processTOCHeadings)) {
md.options.processTOCHeadings(data, state.env);
}
Avoid deeply nested control flow statements. Open
if (!isBlankString(node.content)) {
documentTOC.push({
className: `guide-sub-subnav-item level-${headingLevel}`,
label: node.content || "--",
slug
Function getData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
SearchSource.prototype.getData = function (options, getCursor) {
options = options || {};
const self = this;
this._storeDep.depend();
let selector = {$or: []};
- 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
Avoid deeply nested control flow statements. Open
if (service === "github") {
authString = `?client_id=${settings.clientId}&client_secret=${settings.secret}`;
}
Function renderContent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
renderContent() {
if (Meteor.isClient && DocSearch.getCurrentQuery()) {
if (DocSearch.getCurrentQuery().length > 0) {
return (
<SearchResults
- 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
Avoid deeply nested control flow statements. Open
if (Array.isArray(toc.tocData)) {
// Loop through all entries and add them to the TOC collection
toc.tocData.forEach((tocItem, index) => {
const filename = tocItem.docPath.split("/").pop().replace(/\.[^/.]+$/, "");
Avoid deeply nested control flow statements. Open
if (_.contains(getPublicBranches(), branch.name)) {
const docCount = ReDoc.Collections.Docs.find({
repo: repo.repo,
branch: branch.name
}).count();
Function render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
render() {
// Render admin dashboard
if (Meteor.userId()) {
let badges = [];
- 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
Consider simplifying this complex logical expression. Open
if (this.context.router) {
const branch = selectedBranch || this.props.params.branch || Meteor.settings.public.redoc.branch || "master";
const params = this.props.params;
const repo = params.repo || this.data.defaultDoc.repo;
const alias = params.alias || this.data.defaultDoc.alias;
Function getRepoData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getRepoData() {
let repoData;
if (Meteor.settings.redoc && Meteor.settings.redoc.initRepoData) {
// If the `initRepoData` key is a string, then fetch the repo data from that URL
- 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"