javiercejudo/modelico

View on GitHub

Showing 30 of 30 total issues

Function jsonSchemaMetadata has 327 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const jsonSchemaMetadata = validate => {
  const getSchema = M.getSchema
  const metadata = M.metadata()
  const jscMetadata = {}

Severity: Major
Found in src/metadata/jsonSchemaMetadata.js - About 1 day to fix

    File jsonSchemaMetadata.js has 344 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {
      identity,
      always,
      emptyObject,
      isFunction,
    Severity: Minor
    Found in src/metadata/jsonSchemaMetadata.js - About 4 hrs to fix

      Function jsonSchemaMetadata has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      const jsonSchemaMetadata = validate => {
        const getSchema = M.getSchema
        const metadata = M.metadata()
        const jscMetadata = {}
      
      
      Severity: Minor
      Found in src/metadata/jsonSchemaMetadata.js - About 4 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 customLaunchers has 75 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function customLaunchers() {
        return {
          SL_Chrome: {
            base: 'SauceLabs',
            browserName: 'chrome',
      Severity: Major
      Found in karma.conf.js - About 3 hrs to fix

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

        const getSchema = (metaOrType: Object, topLevel: boolean = true): Object => {
          const metadata = metaOrTypeMapper(M.metadata()._)(metaOrType)
        
          if (metadataSchemaCache.has(metadata)) {
            return metadataSchemaCache.get(metadata) || emptyObject
        Severity: Minor
        Found in src/getSchema.js - About 1 hr to fix

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

          Severity: Minor
          Found in src/U.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 constructor has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(arg1, arg2 = emptyObject, thisArg) {
              let fields = arg2
              let Type = this.constructor
          
              if (isPlainObject(arg1)) {
          Severity: Minor
          Found in src/types/Base.js - About 1 hr to fix

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

            module.exports = function(config) {
              config.set({
                // base path that will be used to resolve all patterns (eg. files, exclude)
                basePath: '',
            
            
            Severity: Minor
            Found in karma.conf.js - About 1 hr to fix

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

              const iterableReviverFactory = (IterableType: any, itemMetadata: any) => (
                k,
                v,
                path = []
              ) => {
              Severity: Minor
              Found in src/iterableHelpers.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 getSchema has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              const getSchema = (metaOrType: Object, topLevel: boolean = true): Object => {
                const metadata = metaOrTypeMapper(M.metadata()._)(metaOrType)
              
                if (metadataSchemaCache.has(metadata)) {
                  return metadataSchemaCache.get(metadata) || emptyObject
              Severity: Minor
              Found in src/getSchema.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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                equals(other) {
                  if (this === other) {
                    return true
                  }
              
              
              Severity: Major
              Found in src/types/Number.js and 1 other location - About 1 hr to fix
              src/types/Maybe.js on lines 186..196

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 60.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                equals(other) {
                  if (this === other) {
                    return true
                  }
              
              
              Severity: Major
              Found in src/types/Maybe.js and 1 other location - About 1 hr to fix
              src/types/Number.js on lines 62..72

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 60.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function createUnionType has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const createUnionType = (metasOrTypes, classifier, union = defaultUnion) => {
                const metas = metasOrTypes.map(
                  x => (isPlainObject(x) && !(x instanceof M.Enum) ? x : M.metadata()._(x))
                )
              
              
              Severity: Minor
              Found in src/createUnionType.js - About 1 hr to fix

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                  constructor(innerMap) {
                    super(StringMap, innerMap, EMPTY_STRING_MAP)
                
                    if (!EMPTY_STRING_MAP && this.size === 0) {
                      EMPTY_STRING_MAP = this
                Severity: Major
                Found in src/types/StringMap.js and 2 other locations - About 1 hr to fix
                src/types/EnumMap.js on lines 42..50
                src/types/Map.js on lines 32..40

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 57.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                  constructor(innerMap) {
                    super(EnumMap, innerMap, EMPTY_ENUM_MAP)
                
                    if (!EMPTY_ENUM_MAP && this.size === 0) {
                      EMPTY_ENUM_MAP = this
                Severity: Major
                Found in src/types/EnumMap.js and 2 other locations - About 1 hr to fix
                src/types/Map.js on lines 32..40
                src/types/StringMap.js on lines 35..43

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 57.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                  constructor(innerMap) {
                    super(ModelicoMap, innerMap, EMPTY_MAP)
                
                    if (!EMPTY_MAP && this.size === 0) {
                      EMPTY_MAP = this
                Severity: Major
                Found in src/types/Map.js and 2 other locations - About 1 hr to fix
                src/types/EnumMap.js on lines 42..50
                src/types/StringMap.js on lines 35..43

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 57.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Function toJSON has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  toJSON() {
                    const v = this.inner()
                
                    return Object.is(v, -0)
                      ? '-0'
                Severity: Minor
                Found in src/types/Number.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 iterableEquals has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                export const iterableEquals = (
                  thisArg: any,
                  other: any,
                  asUnordered: boolean = false
                ) => {
                Severity: Minor
                Found in src/iterableHelpers.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 getSchemaImpl has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const getSchemaImpl = (metadata: Object): Object => {
                  if (metadata.schema) {
                    return enhanceSchemaWithDefault(metadata, metadata.schema())
                  }
                
                
                Severity: Minor
                Found in src/getSchema.js - About 1 hr to fix

                  Function equals has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    equals(other, asUnordered = false) {
                      if (this === other) {
                        return true
                      }
                  
                  
                  Severity: Minor
                  Found in src/types/AbstractMap.js - About 55 mins 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

                  Severity
                  Category
                  Status
                  Source
                  Language