Showing 8 of 22 total issues

Function PropertyDetail has a Cognitive Complexity of 68 (exceeds 25 allowed). Consider refactoring.
Open

const PropertyDetail = (props: IPropertyDetail) => {
  const navigate = useNavigate();
  const params = useParams();
  const { keycloak } = useContext(AuthContext);
  const { getLookupValueById } = useContext(LookupContext);
Severity: Minor
Found in react-app/src/components/property/PropertyDetail.tsx - About 7 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 PropertyTable has a Cognitive Complexity of 53 (exceeds 25 allowed). Consider refactoring.
Open

const PropertyTable = (props: IPropertyTable) => {
  const [totalCount, setTotalCount] = useState(0);
  const api = usePimsApi();
  const { navigateAndSetFrom } = useHistoryAwareNavigate();
  const snackbar = useContext(SnackBarContext);
Severity: Minor
Found in react-app/src/components/property/PropertyTable.tsx - 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 FilterSearchDataGrid has a Cognitive Complexity of 43 (exceeds 25 allowed). Consider refactoring.
Open

export const FilterSearchDataGrid = (props: FilterSearchDataGridProps) => {
  const DEFAULT_PAGE = 0;
  const DEFAULT_PAGESIZE = 100;

  const [searchParams, setSearchParams] = useSearchParams();
Severity: Minor
Found in react-app/src/components/table/DataTable.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 ProjectDetail has a Cognitive Complexity of 36 (exceeds 25 allowed). Consider refactoring.
Open

const ProjectDetail = (props: IProjectDetail) => {
  const navigate = useNavigate();
  const { id } = useParams();
  const { keycloak } = useContext(AuthContext);
  const lookup = useContext(LookupContext);
Severity: Minor
Found in react-app/src/components/projects/ProjectDetail.tsx - About 2 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 ParcelMap has a Cognitive Complexity of 31 (exceeds 25 allowed). Consider refactoring.
Open

const ParcelMap = (props: ParcelMapProps) => {
  const MapEvents = () => {
    useMapEvents({
      resize: () => {
        setPopupState({ ...popupState, open: false });
Severity: Minor
Found in react-app/src/components/map/ParcelMap.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

Avoid deeply nested control flow statements.
Open

              if (!notifExists) {
                //If there is no notification like this already pending, we send one.
                const sendOn = new Date(mostRecentStatusChangeDate.getTime());
                sendOn.setDate(mostRecentStatusChangeDate.getDate() + statusNotif.DelayDays);
                //We set the delay by the most recent status change date plus the number of delay days. This should make these new emails
Severity: Major
Found in express-api/src/services/notifications/notificationServices.ts - About 45 mins to fix

    Function usePropertiesApi has a Cognitive Complexity of 26 (exceeds 25 allowed). Consider refactoring.
    Open

    const usePropertiesApi = (absoluteFetch: IFetch) => {
      const config = useContext(ConfigContext);
      const keycloak = useSSO();
    
      const propertiesFuzzySearch = async (keyword: string) => {
    Severity: Minor
    Found in react-app/src/hooks/api/usePropertiesApi.ts - 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

    Function importPropertiesAsJSON has a Cognitive Complexity of 26 (exceeds 25 allowed). Consider refactoring.
    Open

    const importPropertiesAsJSON = async (
      worksheet: WorkSheet,
      user: User,
      roles: string[],
      resultId: number,
    Severity: Minor
    Found in express-api/src/services/properties/propertiesServices.ts - 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