Showing 20 of 36 total issues
File globals.js
has 816 lines of code (exceeds 250 allowed). Consider refactoring. Open
export default {
__dirname: false,
__filename: false,
AbortController: false,
AbortSignal: false,
Function stem
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
const stem = str => {
// Exit early
if (str.length < 3) return str;
let firstCharacterWasLowerCaseY;
- 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
File settings.js
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
export default {
serverStopWords: [
'a',
'about',
'above',
Function recommendSnippets
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
recommendSnippets() {
const recommendableSnippets = this.recommendableSnippets(
this.object.languageId,
this.object.primaryTag
);
Function extractCollectionSnippetData
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const extractCollectionSnippetData = (collections, snippets) => {
const rankedSnippets = [...snippets].sort((a, b) => b.ranking - a.ranking);
const collectionSnippets = collections
.map(collection => {
Function collectionSnippets
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map(collection => {
const {
id: collectionId,
snippetIds,
matchers,
Function extractCollectionData
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const extractCollectionData = async (collectionGlob, hub) => {
const { featuredListings } = hub;
const collections = await FileHandler.read(collectionGlob);
return await Promise.all(
Function extractSnippetData
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const extractSnippetData = async (snippetGlob, languageData) => {
const snipppetData = await FileHandler.read(snippetGlob);
return await Promise.all(
snipppetData.map(async snippet => {
Function stem
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const stem = str => {
// Exit early
if (str.length < 3) return str;
let firstCharacterWasLowerCaseY;
Function processAssets
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async processAssets({ force = false }) {
const convertedAssets = [
...new Set(
globSync(convertedAssetGlobPattern).map(asset =>
asset
Function extractCollectionSnippetData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const extractCollectionSnippetData = (collections, snippets) => {
const rankedSnippets = [...snippets].sort((a, b) => b.ranking - a.ranking);
const collectionSnippets = collections
.map(collection => {
- 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 searchByKeyphrase
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
searchByKeyphrase(keyphrase) {
let q = keyphrase.toLowerCase().trim();
if (q.length <= 1) return [];
let results = [];
if (q.length) {
Function prepareRecommendableSnippets
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
static prepareRecommendableSnippets() {
this.candidates = Snippet.scope('published', 'byRanking');
const groupedCandidates = this.candidates.reduce((acc, snippet) => {
if (!acc[snippet.languageId]) acc[snippet.languageId] = [];
Function prepare
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
static prepare(model, indexes) {
const name = model.name;
// Create an array for each model to store instances
if (!Model.instances[name]) Model.instances[name] = [];
Function generate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
static generate() {
const { name, description, url } = settings.website;
const data = `\
<rss
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return collectionSnippets.map((snippet, index) => ({
collectionId,
snippetId: snippet.id,
position: snippet.listed ? index : -1,
dateModified: snippet.dateModified,
Function prepare
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static prepare(model, indexes) {
const name = model.name;
// Create an array for each model to store instances
if (!Model.instances[name]) Model.instances[name] = [];
- 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 sublinks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
get sublinks() {
if (this.object.isMain) {
return Collection.scope('primary', 'byRanking')
.map(collection => this.toSublink(collection))
.flat()
- 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"