Showing 407 of 1,024 total issues
Function componentDidUpdate
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
componentDidUpdate(prevProps) {
// update audioFile
if (this.props.audioFile !== this.props.audioFile) {
this._loadAudio(this.props.audioFile, this.props.audioPeaks);
}
Method build
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 pageType
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const pageType = (function() {
var base = {
enhance: function(pageElement, configuarion) {},
prepare: function(pageElement, configuarion) {},
unprepare: function(pageElement, configuarion) {},
Function hideText
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const hideText = (function() {
function element() {
return $('body');
}
Function connectInItemScope
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function connectInItemScope(mapStateToProps, mapDispatchToProps, mergeProps) {
const connecter = connect(
mapStateToProps ? (state, props) => {
const result = mapStateToProps(
addItemScope(state, collectionName, props[itemScopeProperty]),
Function PageTypeRegistry
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function PageTypeRegistry() {
const pageTypes = [];
this.register = function(name, {component, reduxModules = [], ...options}) {
if (!component) {
Function onRender
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
onRender: function() {
let menuOptions = [
{
label: I18n.t('pageflow.editor.views.files_view.upload'),
Function MenuBarButton
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function MenuBarButton(props) {
const {subMenuItems, onClick} = props;
const [subMenuExpanded, setSubMenuExpanded] = useState(props.subMenuExpanded);
const closeMenuTimeout = useRef();
Function _create
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_create: function() {
var startX, startY, startTime,
distX, distY;
this.options = _.extend({
Function createMockPlayer
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Open
_create: function() {
var $element = this.element,
options = this.options,
$links = options.links || $('a', $element),
$subMenu = options.subMenu || $($element.find('.sub_share')),
Function pageflowPagedReact
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const pageflowPagedReact = ['client', 'server'].map(target => {
var targetGlobals = {
client: {
'backbone': 'Backbone',
'react-dom': 'ReactDOM'
Method build
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def build(user, parent, entity_type)
if parent.is_a?(User)
button_label = I18n.t("pageflow.admin.#{entity_type}.add")
path = new_admin_user_membership_path(
parent, entity_type: to_class_name(entity_type)
Method build
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Function classMethods
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Base.classMethods = function(Constructor) {
return {
find: function(viewOrParentElement) {
var selector = Constructor.prototype.selector;
var parentElement = viewOrParentElement.$el || viewOrParentElement;
Function pageSplitLayout
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const pageSplitLayout = (function() {
return {
/**
* Determine if the page is wide enough to display two columns.
*
Function add
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
add: function(upload, options) {
options = options || {};
var editor = options.editor || editorApi;
var fileType = this.fileTypes.findByUpload(upload);
var file = new fileType.model({
Method webpack_config
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def webpack_config
gsub_file(
'config/webpack/webpack.config.js',
"const { generateWebpackConfig } = require('shakapacker')",
"const { generateWebpackConfig, merge, mergeWithRules } = require('shakapacker')"
Function detectFeatures
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
detectFeatures: function() {
var promises = {};
var asyncHas = function(name) {
var runTest = function() {
Function phoneLandscapeFullscreen
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
export const phoneLandscapeFullscreen = function() {
if (window.screen.orientation) {
if (browser.has('phone platform') && !browser.has('iphone platform')) {
window.screen.orientation.onchange = function() {
if (isLandscape()) {
- 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"