iteratehq/react-native-iterate

View on GitHub

Showing 12 of 18 total issues

Function addSorting has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

var addSorting = (function() {
    'use strict';
    var cols,
        currentSort = {
            index: 0,
Severity: Minor
Found in coverage/lcov-report/sorter.js - About 6 hrs 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 addSorting has 161 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var addSorting = (function() {
    'use strict';
    var cols,
        currentSort = {
            index: 0,
Severity: Major
Found in coverage/lcov-report/sorter.js - About 6 hrs to fix

    Function SurveyView has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    const SurveyView: (Props: Props) => JSX.Element = ({
      companyAuthToken,
      displayedSurveyResponseId,
      eventTraits,
      onDismiss,
    Severity: Minor
    Found in src/components/Survey.tsx - About 3 hrs 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 reducer has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const reducer = (state: State = INITIAL_STATE, action: Action) => {
      switch (action.type) {
        case 'DISMISS':
          return {
            ...state,
    Severity: Major
    Found in src/redux.tsx - About 3 hrs to fix

      Function init has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var jumpToCode = (function init() {
          // Classes of code we would like to highlight in the file view
          var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
      
          // Elements to highlight in the file listing view
      Severity: Major
      Found in coverage/lcov-report/block-navigation.js - About 2 hrs to fix

        Function App has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const App = () => {
          React.useEffect(() => {
            Iterate.init({
              apiKey: apiKey,
              safeArea: useSafeAreaInsets,
        Severity: Major
        Found in example/src/App.tsx - About 2 hrs to fix

          File redux.tsx has 252 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import type { EdgeInsets } from './types';
          import type {
            EventTraits,
            EventTraitsMap,
            PresentationStyle,
          Severity: Minor
          Found in src/redux.tsx - About 2 hrs to fix

            Method initializeFlipper has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
                if (FlipperUtils.shouldEnableFlipper(context)) {
                  final FlipperClient client = AndroidFlipperClient.getInstance(context);
            
                  client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));

              Function Prompt has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              const Prompt: (Props: Props) => JSX.Element = ({
                dispatchShowSurvey,
                onDismiss,
                safeAreaInsets,
                survey,
              Severity: Minor
              Found in src/components/Prompt/index.tsx - 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 init has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              var jumpToCode = (function init() {
                  // Classes of code we would like to highlight in the file view
                  var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
              
                  // Elements to highlight in the file listing view
              Severity: Minor
              Found in coverage/lcov-report/block-navigation.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 enableUI has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function enableUI() {
                      var i,
                          el,
                          ithSorter = function ithSorter(i) {
                              var col = cols[i];
              Severity: Minor
              Found in coverage/lcov-report/sorter.js - About 1 hr to fix

                Function setUserTraits has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const setUserTraits = (traits: UserTraits): SetUserTraits => {
                  const validTraits: UserTraitsContext = {};
                  Object.entries(traits).forEach(([key, value]) => {
                    switch (typeof value) {
                      case 'boolean':
                Severity: Minor
                Found in src/redux.tsx - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language