Showing 451 of 1,081 total issues
Method entry_global_links
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def entry_global_links(entry)
links = []
if entry.site.imprint_link_label.present? && entry.site.imprint_link_url.present?
links << link_to(
- 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
Method build
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def build(user)
embedded_index_table(user.memberships.on_accounts
.includes(:account).references(:pageflow_accounts)
.accessible_by(current_ability, :index),
blank_slate_text: t('pageflow.admin.users.no_accounts')) do
- 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
Method redirect_path
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def redirect_path
if params[:user_id].present? && authorized?(:redirect_to_user, resource.user)
tab = resource.entity_type == 'Pageflow::Account' ? 'accounts' : 'entries'
admin_user_path(params[:user_id], tab: tab)
elsif params[:user_id].present? && authorized?(:index, resource.user)
- 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 classMethods
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Base.classMethods = function(Constructor) {
return {
find: function(viewOrParentElement) {
var selector = Constructor.prototype.selector;
var parentElement = viewOrParentElement.$el || viewOrParentElement;
- 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 webAudio
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const webAudio = function(player, audioContext) {
var gainNode;
var currentResolve;
var currentTimeout;
- 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 AudioPlayer
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const AudioPlayer = function(sources, options) {
options = options || {};
var codecMapping = {
vorbis: 'audio/ogg',
- 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 withVisibilityWatching
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function withVisibilityWatching(Component) {
return class VisibilityWatcher extends React.Component {
constructor(props) {
super(props);
Function componentDidUpdate
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
componentDidUpdate(prevProps) {
// update audioFile
if (this.props.audioFile !== this.props.audioFile) {
this._loadAudio(this.props.audioFile, this.props.audioPeaks);
}
Function PreparedMediaPlayer
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function PreparedMediaPlayer(props){
let playerRef = useRef();
let previousPlayerState = useRef(props.playerState);
let eventContextData = useEventContextData();
let unwatchPlayer;
Method build
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build(user)
embedded_index_table(user.memberships.on_entries
.includes(:entry, entry: :account).references(:pageflow_entries)
.accessible_by(current_ability, :index),
blank_slate_text: t('pageflow.admin.users.no_entries')) do
Function PageTypeRegistry
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function PageTypeRegistry() {
const pageTypes = [];
this.register = function(name, {component, reduxModules = [], ...options}) {
if (!component) {
Function hideText
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const hideText = (function() {
function element() {
return $('body');
}
Function connectInItemScope
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function connectInItemScope(mapStateToProps, mapDispatchToProps, mergeProps) {
const connecter = connect(
mapStateToProps ? (state, props) => {
const result = mapStateToProps(
addItemScope(state, collectionName, props[itemScopeProperty]),
Function pageType
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const pageType = (function() {
var base = {
enhance: function(pageElement, configuarion) {},
prepare: function(pageElement, configuarion) {},
unprepare: function(pageElement, configuarion) {},
Function onRender
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
onRender() {
this.updateTransition();
this.updateCutoffIndicator();
this.updateHidden();
Function MenuBarButton
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function MenuBarButton(props) {
const {subMenuItems, onClick} = props;
const [subMenuExpanded, setSubMenuExpanded] = useState(props.subMenuExpanded);
const closeMenuTimeout = useRef();
Function onRender
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
onRender: function() {
let menuOptions = [
{
label: I18n.t('pageflow.editor.views.files_view.upload'),
Function createMockPlayer
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createMockPlayer(element) {
return {
currentTime: sinon.stub(),
bufferedEnd: sinon.stub(),
duration: sinon.stub(),
Function _create
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
_create: function() {
var $element = this.element,
options = this.options,
$links = options.links || $('a', $element),
$subMenu = options.subMenu || $($element.find('.sub_share')),
Function _create
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
_create: function() {
var startX, startY, startTime,
distX, distY;
this.options = _.extend({