wordnik/swagger-editor

View on GitHub

Showing 206 of 206 total issues

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

export const isOAS3ResponseSchema = (state, node) => () => {
  const [key,, gpKey,, gggpKey] = node.path.slice().reverse()

  return key === "schema"
    && gpKey === "content"
Severity: Major
Found in src/plugins/validate-semantic/selectors.js and 1 other location - About 1 hr to fix
src/plugins/validate-semantic/selectors.js on lines 80..86

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 72.

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

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

const tagItem = (updateForm, path) => 
  fromJS({
    tag: {
      value: "",
      isRequired: true, 
src/standalone/topbar-insert/forms/form-objects/add-operation-tags.js on lines 4..14

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 72.

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 find has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function find(astValue, astKeyValue) {
    if (astValue.tag === MAP_TAG) {
      for (i = 0; i < astValue.value.length; i++) {
        var pair = astValue.value[i]
        var key = pair[0]
Severity: Minor
Found in src/plugins/ast/ast.js - About 1 hr to fix

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

    export function checkForDefinition(paramName, pathItem) {
      const pathItemParameters = pathItem.parameters
      const operationsInPathItem = (Object.keys(pathItem) || [])
        .filter(key => operationKeys.indexOf(key) > -1)
        .map(key => {
    Severity: Minor
    Found in src/plugins/validate-semantic/validators/helpers.js - About 1 hr to fix

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

      export function getLineNumberForPath(yaml, path) {
      
        // Type check
        if (typeof yaml !== "string") {
          throw new TypeError("yaml should be a string")
      Severity: Minor
      Found in src/plugins/ast/ast.js - About 1 hr to fix

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

          const updatedFormData = formData.map((formItem) => {
            const value = formItem.get("value")
            const isRequired = formItem.get("isRequired")
        
            // The form field represents a mapping (keyValue => value).
        Severity: Minor
        Found in src/standalone/topbar-insert/forms/helpers/validation-helpers.js - About 1 hr to fix

          Function getRefType has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          export const getRefType = (state, path) => (sys) => createSelector(
            () => {
            for( var i=path.length-1; i>-1; i-- ) {
              let tag = path[i]
              if(sys.specSelectors.isOAS3 && sys.specSelectors.isOAS3()) {
          Severity: Minor
          Found in src/plugins/editor-autosuggest/spec-selectors.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 getKeywordsForPath has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function getKeywordsForPath({ system, path, keywordMap}) {
            keywordMap = Object.assign({}, keywordMap)
          
            // is getting path was not successful stop here and return no candidates
            if (!isArray(path)) {

          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 getKeywordsForPath has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function getKeywordsForPath({ system, path, keywordMap }) {
            keywordMap = Object.assign({}, keywordMap)
          
            // is getting path was not successful stop here and return no candidates
            if (!isArray(path)) {
          Severity: Minor
          Found in src/plugins/editor-autosuggest-keywords/get-keywords-for-path.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 transformPathToArray has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function transformPathToArray(property, jsSpec) {
            if (property.slice(0, 9) === "instance.") {
              var str = property.slice(9)
            } else {
              // eslint-disable-next-line no-redeclare
          Severity: Minor
          Found in src/plugins/json-schema-validator/validator/path-translator.js - About 1 hr to fix

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

                title: { 
                  value: existingValues ? existingValues.get("title") : "", 
                  isRequired: true, 
                  name: "Title",
                  description: "REQUIRED. The title of the application.",
            src/standalone/topbar-insert/forms/form-objects/info-object.js on lines 21..28

            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 69.

            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

                version: {
                  value: existingValues ? existingValues.get("version") : "", 
                  isRequired: true, 
                  name: "Version",
                  description: "REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).",
            src/standalone/topbar-insert/forms/form-objects/info-object.js on lines 7..14

            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 69.

            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 find has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function find(current) {
            
                // algorythm:
                // is current a promitive?
                //   // finish recursion without modifying the path
            Severity: Minor
            Found in src/plugins/ast/ast.js - About 1 hr to fix

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

                      if(typeof minProperties === "number" && typeof maxProperties === "number" && (minProperties > maxProperties)) {
                        acc.push({
                          message: "'minProperties' must be lower value than 'maxProperties'",
                          path: [...node.path, "minProperties"],
                          level: "error",
              Severity: Major
              Found in src/plugins/validate-semantic/validators/2and3/schemas.js and 3 other locations - About 1 hr to fix
              src/plugins/validate-semantic/validators/2and3/schemas.js on lines 103..109
              src/plugins/validate-semantic/validators/2and3/schemas.js on lines 111..117
              src/plugins/validate-semantic/validators/2and3/schemas.js on lines 127..133

              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 67.

              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

                specSelectors: PropTypes.shape({
                  specJson: PropTypes.func.isRequired,
                  info: PropTypes.func.isRequired,
                  paths: PropTypes.func.isRequired,
                  isOAS3: PropTypes.func.isRequired,
              Severity: Major
              Found in src/standalone/topbar-insert/topbar-insert.jsx and 1 other location - About 1 hr to fix
              src/standalone/topbar-menu-edit-convert/components/convert-modal.jsx on lines 86..92

              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 67.

              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

              ConvertModal.propTypes = {
                editorContent: PropTypes.string.isRequired,
                converterUrl: PropTypes.string.isRequired,
                getComponent: PropTypes.func.isRequired,
                updateEditorContent: PropTypes.func.isRequired,
              src/standalone/topbar-insert/topbar-insert.jsx on lines 301..307

              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 67.

              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 4 locations. Consider refactoring.
              Open

                      if(typeof minLength === "number" && typeof maxLength === "number" && (minLength > maxLength)) {
                        acc.push({
                          message: "'minLength' must be lower value than 'maxLength'",
                          path: [...node.path, "minLength"],
                          level: "error",
              Severity: Major
              Found in src/plugins/validate-semantic/validators/2and3/schemas.js and 3 other locations - About 1 hr to fix
              src/plugins/validate-semantic/validators/2and3/schemas.js on lines 103..109
              src/plugins/validate-semantic/validators/2and3/schemas.js on lines 119..125
              src/plugins/validate-semantic/validators/2and3/schemas.js on lines 127..133

              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 67.

              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 validate2And3TypesInDefaultValuesMatchesWithEnum has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const validate2And3TypesInDefaultValuesMatchesWithEnum = () => (system) => {
                return system.validateSelectors
                  .allSchemas()
                  .then(nodes => {
                    return nodes.reduce((acc, node) => {
              Severity: Minor
              Found in src/plugins/validate-semantic/validators/2and3/schemas.js - About 1 hr to fix

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

                        if(typeof minimum === "number" && typeof maximum === "number" && (minimum > maximum)) {
                          acc.push({
                            message: "'minimum' must be lower value than 'maximum'",
                            path: [...node.path, "minimum"],
                            level: "error",
                Severity: Major
                Found in src/plugins/validate-semantic/validators/2and3/schemas.js and 3 other locations - About 1 hr to fix
                src/plugins/validate-semantic/validators/2and3/schemas.js on lines 111..117
                src/plugins/validate-semantic/validators/2and3/schemas.js on lines 119..125
                src/plugins/validate-semantic/validators/2and3/schemas.js on lines 127..133

                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 67.

                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 validateParameterFormDataConsumesType has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const validateParameterFormDataConsumesType = () => system => {
                  return system.validateSelectors
                    .allPathItems()
                    .then(nodes => {
                      return nodes.reduce((acc, node) => {
                Severity: Minor
                Found in src/plugins/validate-semantic/validators/form-data.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language