Showing 8 of 9 total issues
Function Element
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Element = () => {
const code = `
<Map height="200px" center={{lat: 50.0755, lng: 14.4378}}>
<KeyboardControl/>
<ZoomControl/>
Function DynamicRoute
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DynamicRoute = () => {
const [criterion, setCriterion] = useState<string>('fast');
const code = `
<Map height="200px" center={{lat: 49.536, lng: 18.499}} zoom={12}>
Function Marker
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Marker = (props: MarkerProps) => {
const markerLayer = useContext<any>(MarkerLayerContext);
const renderMarkerUrl = (url?: string | Element | MarkerRender) => {
if (isMarkerRender(url)) {
Function Marker
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
const Marker = (props: MarkerProps) => {
const markerLayer = useContext<any>(MarkerLayerContext);
const renderMarkerUrl = (url?: string | Element | MarkerRender) => {
if (isMarkerRender(url)) {
- Read upRead up
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
Open
const RouteInfo = () => {
const [routeInfo, setRouteInfo] = useState<null | RouteInfoResultProps>(null);
const fetchRouteInfo = useCallback(async () => {
const info = await getRouteInfo(coords, params as any);
Function Map
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
Function MapElement
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const MapElement = () => {
const code = `
<Map height="200px" center={{lat: 50.0755, lng: 14.4378}} />
`
return (
Function Home
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Home = () => {
return (
<SHome>
<div style={{width: '40%'}}>
<h1>react-mapycz</h1>