codevise/pageflow

View on GitHub

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(
Severity: Minor
Found in app/helpers/pageflow/entries_helper.rb - About 1 hr to fix

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
Severity: Minor
Found in app/views/components/pageflow/admin/user_accounts_tab.rb - About 1 hr to fix

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)
Severity: Minor
Found in admins/pageflow/membership.rb - About 1 hr to fix

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;
Severity: Minor
Found in package/src/testHelpers/dominos/Base.js - About 1 hr to fix

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;
Severity: Minor
Found in package/src/frontend/mediaPlayer/volumeFading/webAudio.js - About 1 hr to fix

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',
Severity: Minor
Found in package/src/frontend/AudioPlayer/AudioPlayer.js - About 1 hr to fix

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;
      Severity: Minor
      Found in entry_types/scrolled/package/src/frontend/MediaPlayer/index.js - About 1 hr to fix

        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
        Severity: Minor
        Found in app/views/components/pageflow/admin/user_entries_tab.rb - About 1 hr to fix

          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) {},
                Severity: Minor
                Found in entry_types/paged/packages/pageflow-paged/src/frontend/pageType.js - About 1 hr to fix

                  Function onRender has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    onRender() {
                      this.updateTransition();
                      this.updateCutoffIndicator();
                      this.updateHidden();
                  
                  
                  Severity: Minor
                  Found in entry_types/scrolled/package/src/editor/views/SectionItemView.js - About 1 hr to fix

                    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'),
                      Severity: Minor
                      Found in package/src/editor/views/FilesView.js - About 1 hr to fix

                        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({
                              Severity
                              Category
                              Status
                              Source
                              Language