p632-sp-2017/microservice-catalog-frontend

View on GitHub

Showing 6 of 21 total issues

Function CatalogDataView has 130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CatalogDataView = (props) => {
    const { dispatch, catalogData, loading, filterText, errorfetching } = props;
    let open = false;
    let initHeight = 120;
    let intval = null;
Severity: Major
Found in src/main/app/src/containers/DataView/DataView.js - About 5 hrs to fix

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

    let EditForm = (props) => {
      const { onSubmitEdit, submitSucceeded, error, handleSubmit, pristine, reset, submitting, initialValues }=props;
    
      return(
        <div>
    Severity: Minor
    Found in src/main/app/src/component/AddMicroservice/EditForm.js - About 1 hr to fix

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

          const slideToggle = (element) => {
            window.clearInterval(intval);
            let mdiv = document.getElementById('mdiv');
            mdiv = element;
            if(getComputedStyle(mdiv).getPropertyValue('display') === "none"){
      Severity: Minor
      Found in src/main/app/src/containers/DataView/DataView.js - About 1 hr to fix

        Function CatalogDataView has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        const CatalogDataView = (props) => {
            const { dispatch, catalogData, loading, filterText, errorfetching } = props;
            let open = false;
            let initHeight = 120;
            let intval = null;
        Severity: Minor
        Found in src/main/app/src/containers/DataView/DataView.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 AddForm has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const AddForm = (props) => {
          const { onSubmitAdd, submitSucceeded, error, handleSubmit, pristine, reset, submitting }=props;
          return(
            <div>
              <PageHeader>Add a New MicroService</PageHeader>
        Severity: Minor
        Found in src/main/app/src/component/AddMicroservice/AddForm.js - About 1 hr to fix

          Function DetailView has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          const DetailView = (serviceDetails) => {
            let detailHtml = [];
            let data = serviceDetails;
            let keys = Object.keys(data);
            for(let i=0; i<keys.length; i++){
          Severity: Minor
          Found in src/main/app/src/component/DetailView/DetailView.js - About 25 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