flsy/react-mapycz

View on GitHub

Showing 8 of 9 total issues

Function Element has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Element = () => {
  const code = `
    <Map height="200px" center={{lat: 50.0755, lng: 14.4378}}>
      <KeyboardControl/>
      <ZoomControl/>
Severity: Major
Found in home/Element.tsx - About 2 hrs to fix

    Function DynamicRoute has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const DynamicRoute = () => {
      const [criterion, setCriterion] = useState<string>('fast');
    
      const code = `
        <Map height="200px" center={{lat: 49.536, lng: 18.499}} zoom={12}>
    Severity: Major
    Found in home/DynamicRoute.tsx - About 2 hrs to fix

      Function Marker has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Marker = (props: MarkerProps) => {
          const markerLayer = useContext<any>(MarkerLayerContext);
      
          const renderMarkerUrl = (url?: string | Element | MarkerRender) => {
              if (isMarkerRender(url)) {
      Severity: Major
      Found in src/Marker.tsx - About 2 hrs to fix

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

        const Marker = (props: MarkerProps) => {
            const markerLayer = useContext<any>(MarkerLayerContext);
        
            const renderMarkerUrl = (url?: string | Element | MarkerRender) => {
                if (isMarkerRender(url)) {
        Severity: Minor
        Found in src/Marker.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 RouteInfo has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const RouteInfo = () => {
          const [routeInfo, setRouteInfo] = useState<null | RouteInfoResultProps>(null);
        
          const fetchRouteInfo = useCallback(async () => {
            const info = await getRouteInfo(coords, params as any);
        Severity: Minor
        Found in home/RouteInfo.tsx - About 1 hr to fix

          Function Map has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const Map = (props: MapProps) => {
            const mapNode = useRef(null);
            const [map, setMap] = useState<any>(null);
            const {width, height, children, onEvent, eventNameListener = "*", zoom, center, animateCenterZoom} = props;
          
          
          Severity: Minor
          Found in src/Map.tsx - About 1 hr to fix

            Function MapElement has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const MapElement = () => {
              const code = `
                <Map height="200px" center={{lat: 50.0755, lng: 14.4378}} />
              `
              return (
            Severity: Minor
            Found in home/MapElement.tsx - About 1 hr to fix

              Function Home has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Home = () => {
                return (
                  <SHome>
                    <div style={{width: '40%'}}>
                      <h1>react-mapycz</h1>
              Severity: Minor
              Found in home/Home.tsx - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language