dopry/netlify-cms

View on GitHub

Showing 110 of 220 total issues

Function render has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const {
      user,
      collections,
      runCommand,
Severity: Minor
Found in src/components/AppHeader/AppHeader.js - About 1 hr to fix

    Function localSearch has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function localSearch(searchTerm, getState, dispatch) {
      return (function acc(localResults = { entries: [] }) {
        function processCollection(collection, collectionKey) {
          const state = getState();
          if (state.entries.hasIn(['pages', collectionKey, 'ids'])) {
    Severity: Minor
    Found in src/actions/search.js - About 1 hr to fix

      Function render has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const { onAddAsset, onRemoveAsset, getAsset } = this.props;
      
          return (
            <div className={styles.wrapper}>

        Function onKeyDown has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function onKeyDown(e, data, state) {
          const createDefaultBlock = () => {
            return Block.create({
              type: 'paragraph',
              nodes: [Text.createFromString('')]

          Function entries has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const entries = (state = defaultState, action) => {
            switch (action.type) {
              case SEARCH_CLEAR:
                return defaultState;
          
          
          Severity: Minor
          Found in src/reducers/search.js - About 1 hr to fix

            Function remarkPaddedLinks has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function remarkPaddedLinks() {
            
              function transform(node) {
            
                /**
            Severity: Minor
            Found in src/components/Widgets/Markdown/serializers/remarkPaddedLinks.js - About 1 hr to fix

              Function sortKeys has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              const sortKeys = (sortedKeys = []) => (a, b) => {
                const idxA = sortedKeys.indexOf(a);
                const idxB = sortedKeys.indexOf(b);
                if (idxA === -1 || idxB === -1) {
                  if (a > b) return 1;
              Severity: Minor
              Found in src/formats/yaml.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 processCollection has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function processCollection(collection, collectionKey) {
                    const state = getState();
                    if (state.entries.hasIn(['pages', collectionKey, 'ids'])) {
                      const searchFields = [
                        selectInferedField(collection, 'title'),
              Severity: Minor
              Found in src/actions/search.js - About 1 hr to fix

                Function EntryPageHOC has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function EntryPageHOC(EntryPage) {
                  class EntryPageHOC extends React.Component {
                    render() {
                      return <EntryPage {...this.props} />;
                    }
                Severity: Minor
                Found in src/containers/editorialWorkflow/EntryPageHOC.js - About 1 hr to fix

                  Function remarkUnwrapInvalidNest has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function remarkUnwrapInvalidNest() {
                    return transform;
                  
                    function transform(tree) {
                      const invalidNest = findInvalidNest(tree);
                  Severity: Minor
                  Found in src/components/Widgets/Markdown/serializers/remarkAssertParents.js - About 1 hr to fix

                    Function render has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render() {
                        const {
                          entry,
                          entryDraft,
                          fields,
                    Severity: Minor
                    Found in src/containers/EntryPage.js - About 1 hr to fix

                      Function authenticate has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        authenticate(options, cb) {
                          var left, top, url,
                            siteID = this.getSiteID(),
                            provider = options.provider;
                          if (!provider) {
                      Severity: Minor
                      Found in src/lib/netlify-auth.js - About 1 hr to fix

                        Function upload has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          upload(file, privateUpload = false) {
                            const fileData = {
                              name: file.name,
                              size: file.size
                            };
                        Severity: Minor
                        Found in src/integrations/providers/assetStore/implementation.js - About 1 hr to fix

                          Function unpublishedEntries has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            unpublishedEntries() {
                              return this.api.listUnpublishedBranches().then((branches) => {
                                const sem = semaphore(MAX_CONCURRENT_DOWNLOADS);
                                const promises = [];
                                branches.map((branch) => {
                          Severity: Minor
                          Found in src/backends/github/implementation.js - About 1 hr to fix

                            Function render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              render() {
                                const {
                                  plugin,
                                  onSubmit,
                                  onCancel,

                              Function persistEntry has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                persistEntry(config, collection, entryDraft, MediaFiles, options) {
                                  const newEntry = entryDraft.getIn(["entry", "newRecord"]) || false;
                              
                                  const parsedData = {
                                    title: entryDraft.getIn(["entry", "data", "title"], "No Title"),
                              Severity: Minor
                              Found in src/backends/backend.js - About 1 hr to fix

                                Consider simplifying this complex logical expression.
                                Open

                                    if (!unpublished) {
                                      // Open new editorial review workflow for this entry - Create new metadata and commit to new branch`
                                      const contentKey = entry.slug;
                                      const branchName = `cms/${ contentKey }`;
                                
                                
                                Severity: Critical
                                Found in src/backends/github/API.js - About 1 hr to fix

                                  Function updateTree has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    updateTree(sha, path, fileTree) {
                                      return this.getTree(sha)
                                        .then((tree) => {
                                          let obj;
                                          let filename;
                                  Severity: Minor
                                  Found in src/backends/github/API.js - About 1 hr to fix

                                    Function controlFor has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      controlFor(field) {
                                        const { entry, fieldsMetaData, fieldsErrors, getAsset, onChange, onAddAsset, onRemoveAsset } = this.props;
                                        const widget = resolveWidget(field.get('widget'));
                                        const fieldName = field.get('name');
                                        const value = entry.getIn(['data', fieldName]);
                                    Severity: Minor
                                    Found in src/components/ControlPanel/ControlPane.js - About 1 hr to fix

                                      Function renderItem has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        renderItem(item, index) {
                                          const { value, field, getAsset, onAddAsset, onRemoveAsset } = this.props;
                                          const { itemStates } = this.state;
                                          const collapsed = itemStates.getIn([index, 'collapsed']);
                                          const classNames = [styles.item, collapsed ? styles.collapsed : styles.expanded];
                                      Severity: Minor
                                      Found in src/components/Widgets/ListControl.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language