Showing 89 of 875 total issues
Function _getSortingKey
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
_getSortingKey(sort) {
const controller = this.controllerFor(get(this, 'routeName'));
const mediaType = get(controller, 'media');
let sortKey;
- 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 injectBrowser
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function injectBrowser(src) {
return new RSVP.Promise((resolve, reject) => {
// script has been loaded in the past or is currently loading
if (_scriptsLoaded[src]) {
return resolve();
Function momentLocale
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function momentLocale(localeInput = 'en') {
let locale = localeInput;
// Fix for Acadian not having a unique language code
if (locale === 'mis-ca') locale = 'fr-ca';
Function didReceiveAttrs
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
didReceiveAttrs() {
this._super(...arguments);
scheduleOnce('afterRender', () => {
get(this, 'headTags').collectHeadTags();
});
Function uploadImageTask
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
uploadImageTask: task(function* (file) {
const { access_token: accessToken } = get(this, 'session.data.authenticated');
const headers = {
accept: 'application/vnd.api+json',
authorization: `Bearer ${accessToken}`
Function postMessageTask
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
postMessageTask: task(function* () {
const content = get(this, 'replyContent');
if (isEmpty(content)) { return; }
// if the ticket is new then save that first
Function _defineRoutes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _defineRoutes(server) {
server.passthrough('/write-coverage');
// authentication
server.post('/api/oauth/token', { access_token: 'it is a secret, shh' });
Function didReceiveAttrs
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
didReceiveAttrs() {
this._super(...arguments);
scheduleOnce('afterRender', () => {
get(this, 'headTags').collectHeadTags();
});
- 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 getTitleField
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function getTitleField(preference, titleLocales = {}, userLocale) {
switch (preference) {
case 'english':
case 'localized':
if (userLocale in titleLocales) return userLocale;
- 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 _searchEventListener
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_searchEventListener(event) {
if (this.isDestroyed) return;
const target = get(event, 'target');
const id = `#${get(this, 'elementId')}`;
const isChild = matches(target, `${id} *, ${id}`);
- 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 errorMessages
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function errorMessages(obj) {
const defaultMessage = 'There was an issue with your request, please try again.';
let reason = defaultMessage;
if (obj === undefined) {
return reason;
- 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 init
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
init() {
this._super(...arguments);
set(this, 'replies', []);
set(this, 'galleryItems', []);
if (get(this, 'isTopLevel') === true && get(this, 'comment.repliesCount') > 0) {
- 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 title
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
title(tokens) {
const base = 'Kitsu';
// If the route hasn't defined a `titleToken` then try to grab the route
// name from the `titles` table in translations.
const hasTokens = tokens && tokens.length > 0;
- 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function initialize() {
if (window.location.origin.endsWith('.io')) {
// Redirect to the new domain
const url = new URL(window.location);
url.host = url.host.replace('kitsu.io', 'kitsu.app');
- 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 _getFieldsets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_getFieldsets(type) {
const fields = {
libraryEntries: ['progress', 'status', 'rating', 'unit', 'reconsumeCount', 'private',
'startedAt', 'finishedAt', 'notes', 'updatedAt']
};
- 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 avgOrientation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const avgOrientation = (uploads, length) => {
if (length === 5) {
return 'landscape';
}
let o = 1;
- 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 too many return
statements within this function. Open
return '#';
Avoid too many return
statements within this function. Open
return 'fall';
Avoid too many return
statements within this function. Open
return 'percent-quarter-4';
Avoid too many return
statements within this function. Open
if ('en_kr' in titleLocales) return 'en_kr';